public RecordsFamilyHistoryInfoModel DataRowToModel(DataRow row) { RecordsFamilyHistoryInfoModel recordsFamilyHistoryInfoModel = new RecordsFamilyHistoryInfoModel(); if (row != null) { if (((row["ID"] != null) && (row["ID"] != DBNull.Value)) && (row["ID"].ToString() != "")) { recordsFamilyHistoryInfoModel.ID = int.Parse(row["ID"].ToString()); } if ((row["RecordID"] != null) && (row["RecordID"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.RecordID = row["RecordID"].ToString(); } if ((row["IDCardNo"] != null) && (row["IDCardNo"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.IDCardNo = row["IDCardNo"].ToString(); } if ((row["FamilyType"] != null) && (row["FamilyType"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.FamilyType = row["FamilyType"].ToString(); } if ((row["FatherHistory"] != null) && (row["FatherHistory"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.FatherHistory = row["FatherHistory"].ToString(); } if ((row["FatherHistoryOther"] != null) && (row["FatherHistoryOther"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.FatherHistoryOther = row["FatherHistoryOther"].ToString(); } if ((row["MotherHistory"] != null) && (row["MotherHistory"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.MotherHistory = row["MotherHistory"].ToString(); } if ((row["MotherHistoryOther"] != null) && (row["MotherHistoryOther"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.MotherHistoryOther = row["MotherHistoryOther"].ToString(); } if ((row["BrotherSisterHistory"] != null) && (row["BrotherSisterHistory"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.BrotherSisterHistory = row["BrotherSisterHistory"].ToString(); } if ((row["BrotherSisterHistoryOther"] != null) && (row["BrotherSisterHistoryOther"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.BrotherSisterHistoryOther = row["BrotherSisterHistoryOther"].ToString(); } if ((row["ChildrenHistory"] != null) && (row["ChildrenHistory"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.ChildrenHistory = row["ChildrenHistory"].ToString(); } if ((row["ChildrenHistoryOther"] != null) && (row["ChildrenHistoryOther"] != DBNull.Value)) { recordsFamilyHistoryInfoModel.ChildrenHistoryOther = row["ChildrenHistoryOther"].ToString(); } } return(recordsFamilyHistoryInfoModel); }
public bool UpdateServer(RecordsFamilyHistoryInfoModel model) { StringBuilder builder = new StringBuilder(); builder.Append("update ARCHIVE_FAMILYHISTORYINFO set "); builder.Append("RecordID=@RecordID,"); builder.Append("IDCardNo=@IDCardNo,"); builder.Append("FamilyType=@FamilyType,"); builder.Append("FatherHistory=@FatherHistory,"); builder.Append("FatherHistoryOther=@FatherHistoryOther,"); builder.Append("MotherHistory=@MotherHistory,"); builder.Append("MotherHistoryOther=@MotherHistoryOther,"); builder.Append("BrotherSisterHistory=@BrotherSisterHistory,"); builder.Append("BrotherSisterHistoryOther=@BrotherSisterHistoryOther,"); builder.Append("ChildrenHistory=@ChildrenHistory,"); builder.Append("ChildrenHistoryOther=@ChildrenHistoryOther"); builder.Append(" where IDCardNo=@IDCardNo"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@RecordID", MySqlDbType.String, 17), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@FamilyType", MySqlDbType.String, 1), new MySqlParameter("@FatherHistory", MySqlDbType.String, 50), new MySqlParameter("@FatherHistoryOther", MySqlDbType.String, 200), new MySqlParameter("@MotherHistory", MySqlDbType.String, 50), new MySqlParameter("@MotherHistoryOther", MySqlDbType.String, 200), new MySqlParameter("@BrotherSisterHistory", MySqlDbType.String, 50), new MySqlParameter("@BrotherSisterHistoryOther", MySqlDbType.String, 200), new MySqlParameter("@ChildrenHistory", MySqlDbType.String, 50), new MySqlParameter("@ChildrenHistoryOther", MySqlDbType.String, 200) // new MySqlParameter("@ID", MySqlDbType.Int32, 8) }; cmdParms[0].Value = model.RecordID; cmdParms[1].Value = model.IDCardNo; cmdParms[2].Value = model.FamilyType; cmdParms[3].Value = model.FatherHistory; cmdParms[4].Value = model.FatherHistoryOther; cmdParms[5].Value = model.MotherHistory; cmdParms[6].Value = model.MotherHistoryOther; cmdParms[7].Value = model.BrotherSisterHistory; cmdParms[8].Value = model.BrotherSisterHistoryOther; cmdParms[9].Value = model.ChildrenHistory; cmdParms[10].Value = model.ChildrenHistoryOther; // cmdParms[11].Value = model.ID; return(MySQLHelper.ExecuteSqlServer(builder.ToString(), cmdParms) > 0); }
public List <RecordsFamilyHistoryInfoModel> DataTableToList(DataTable dt) { List <RecordsFamilyHistoryInfoModel> list = new List <RecordsFamilyHistoryInfoModel>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { RecordsFamilyHistoryInfoModel item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public int AddServer(RecordsFamilyHistoryInfoModel model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into ARCHIVE_FAMILYHISTORYINFO("); builder.Append("RecordID,IDCardNo,FamilyType,FatherHistory,FatherHistoryOther,MotherHistory,MotherHistoryOther,BrotherSisterHistory,BrotherSisterHistoryOther,ChildrenHistory,ChildrenHistoryOther)"); builder.Append(" values ("); builder.Append("@RecordID,@IDCardNo,@FamilyType,@FatherHistory,@FatherHistoryOther,@MotherHistory,@MotherHistoryOther,@BrotherSisterHistory,@BrotherSisterHistoryOther,@ChildrenHistory,@ChildrenHistoryOther)"); builder.Append(";select @@IDENTITY"); MySqlParameter[] cmdParms = new MySqlParameter[] { new MySqlParameter("@RecordID", MySqlDbType.String, 17), new MySqlParameter("@IDCardNo", MySqlDbType.String, 21), new MySqlParameter("@FamilyType", MySqlDbType.String, 1), new MySqlParameter("@FatherHistory", MySqlDbType.String, 50), new MySqlParameter("@FatherHistoryOther", MySqlDbType.String, 200), new MySqlParameter("@MotherHistory", MySqlDbType.String, 50), new MySqlParameter("@MotherHistoryOther", MySqlDbType.String, 200), new MySqlParameter("@BrotherSisterHistory", MySqlDbType.String, 50), new MySqlParameter("@BrotherSisterHistoryOther", MySqlDbType.String, 200), new MySqlParameter("@ChildrenHistory", MySqlDbType.String, 50), new MySqlParameter("@ChildrenHistoryOther", MySqlDbType.String, 200) }; cmdParms[0].Value = model.RecordID; cmdParms[1].Value = model.IDCardNo; cmdParms[2].Value = model.FamilyType; cmdParms[3].Value = model.FatherHistory; cmdParms[4].Value = model.FatherHistoryOther; cmdParms[5].Value = model.MotherHistory; cmdParms[6].Value = model.MotherHistoryOther; cmdParms[7].Value = model.BrotherSisterHistory; cmdParms[8].Value = model.BrotherSisterHistoryOther; cmdParms[9].Value = model.ChildrenHistory; cmdParms[10].Value = model.ChildrenHistoryOther; object single = MySQLHelper.GetSingleServer(builder.ToString(), cmdParms); if (single == null) { return(0); } return(Convert.ToInt32(single)); }
public int AddServer(RecordsFamilyHistoryInfoModel model) { return(this.dal.AddServer(model)); }
public bool UpdateServer(RecordsFamilyHistoryInfoModel model) { return(this.dal.UpdateServer(model)); }