/// <summary> /// 获得数据列表 /// </summary> public MachineBackups DataTableToListName2(DataTable dt) { MachineBackups model = new MachineBackups(); int rowsCount = dt.Rows.Count; if (rowsCount > 0) { for (int n = 0; n < rowsCount; n++) { model = dal.DataRowToModelName(dt.Rows[n]); } } return(model); }
/// <summary> /// 得到一个对象实体 /// </summary> public MachineBackups DataRowToModelName(DataRow row) { MachineBackups model = new MachineBackups(); if (row != null) { if (row["MachineID"].ToString() != "") { model.MachineID = int.Parse(row["MachineID"].ToString()); } model.Remark = row["Remark"].ToString(); if (row["CreatUserID"].ToString() != "") { model.CreatUserID = int.Parse(row["CreatUserID"].ToString()); } if (row["RecordUpdateUserID"].ToString() != "") { model.RecordUpdateUserID = int.Parse(row["RecordUpdateUserID"].ToString()); } if (row["RecordIsDelete"].ToString() != "") { if ((row["RecordIsDelete"].ToString() == "1") || (row["RecordIsDelete"].ToString().ToLower() == "true")) { model.RecordIsDelete = true; } else { model.RecordIsDelete = false; } } if (row["RecordUpdateTime"].ToString() != "") { model.RecordUpdateTime = DateTime.Parse(row["RecordUpdateTime"].ToString()); } if (row["RecordCreateTime"].ToString() != "") { model.RecordCreateTime = DateTime.Parse(row["RecordCreateTime"].ToString()); } model.Latitude = row["Latitude"].ToString(); model.Longitude = row["Longitude"].ToString(); model.LocationAddress = row["LocationAddress"].ToString(); if (row["AgentId"].ToString() != "") { model.AgentId = int.Parse(row["AgentId"].ToString()); } if (row["UserID"].ToString() != "") { model.UserID = int.Parse(row["UserID"].ToString()); } if (row["MachineSupplierId"].ToString() != "") { model.MachineSupplierId = int.Parse(row["MachineSupplierId"].ToString()); } model.AgentName = row["AgentName"].ToString(); if (row["SupervisorId"].ToString() != "") { model.SupervisorId = int.Parse(row["SupervisorId"].ToString()); } model.SupervisorName = row["SupervisorName"].ToString(); if (row["SalesmanId"].ToString() != "") { model.SalesmanId = int.Parse(row["SalesmanId"].ToString()); } model.SalesmanName = row["SalesmanName"].ToString(); model.SN = row["SN"].ToString(); model.MAC = row["MAC"].ToString(); model.Address = row["Address"].ToString(); if (row["Status"].ToString() != "") { model.Status = int.Parse(row["Status"].ToString()); } model.TeamViewerNumber = row["TeamViewerNumber"].ToString(); model.TeamViewerPwd = row["TeamViewerPwd"].ToString(); model.ActivationCode = row["ActivationCode"].ToString(); //if (row["UserName"] != null) //{ // model.UserName = row["UserName"].ToString(); //} //if (row["LoginName"] != null) //{ // model.LoginName = row["LoginName"].ToString(); //} if (row["Platform"] != null) { model.Platform = row["Platform"].ToString(); } if (row["FlatDeviceNumber"] != null) { model.FlatDeviceNumber = row["FlatDeviceNumber"].ToString(); } //if (row["SId"] != null) //{ // model.SId = row["SId"].ToString(); //} if (row["SignName"] != null) { model.SignName = row["SignName"].ToString(); } } return(model); }