Нет описания

CallRecords.cs 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. using CallCenterApi.DB;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Data;
  5. using System.Linq;
  6. using System.Text;
  7. namespace CallCenterApi.DAL
  8. {
  9. public class CallRecords
  10. {
  11. public CallRecords()
  12. { }
  13. #region BasicMethod
  14. /// <summary>
  15. /// 得到一个对象实体
  16. /// </summary>
  17. public Model.CallResult DataRowToModel(DataRow row)
  18. {
  19. Model.CallResult model = new Model.CallResult();
  20. if (row != null)
  21. {
  22. model.Id = row["Id"] == DBNull.Value ? 0 : Convert.ToInt32(row["Id"]);
  23. model.TaskId = row["itemid"] == DBNull.Value ? 0 : Convert.ToInt32(row["itemid"]);
  24. model.CallNumber = row["Callee"] == DBNull.Value ? "" : row["Callee"].ToString();
  25. model.Usercode = row["AgentId"] == DBNull.Value ? "" : row["AgentId"].ToString();
  26. model.StartDate = row["StartDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["StartDate"].ToString());
  27. model.GetInAgentDate = row["GetInAgentDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["GetInAgentDate"].ToString());
  28. model.EndDate = row["EndDate"] == DBNull.Value ? (DateTime?)null : Convert.ToDateTime(row["EndDate"].ToString());
  29. model.RecordPath = row["RecordPath"] == DBNull.Value ? "" : row["RecordPath"].ToString();
  30. model.Username = row["Username"] == DBNull.Value ? "" : row["Username"].ToString();
  31. model.State = row["State"] == DBNull.Value ? "" : row["State"].ToString();
  32. model.TalkTime = row["TalkTime"] == DBNull.Value ? 0 : Convert.ToInt32(row["TalkTime"]);
  33. }
  34. return model;
  35. }
  36. #endregion BasicMethod
  37. #region ExtensionMethod
  38. #endregion ExtensionMethod
  39. }
  40. }