public RecordsInoculationHistoryModel DataRowToModel(DataRow row)
        {
            RecordsInoculationHistoryModel recordsInoculationHistoryModel = new RecordsInoculationHistoryModel();

            if (row != null)
            {
                if (((row["ID"] != null) && (row["ID"] != DBNull.Value)) && (row["ID"].ToString() != ""))
                {
                    recordsInoculationHistoryModel.ID = int.Parse(row["ID"].ToString());
                }
                if ((row["PhysicalID"] != null) && (row["PhysicalID"] != DBNull.Value))
                {
                    recordsInoculationHistoryModel.PhysicalID = row["PhysicalID"].ToString();
                }
                if ((row["IDCardNo"] != null) && (row["IDCardNo"] != DBNull.Value))
                {
                    recordsInoculationHistoryModel.IDCardNo = row["IDCardNo"].ToString();
                }
                if ((row["PillName"] != null) && (row["PillName"] != DBNull.Value))
                {
                    recordsInoculationHistoryModel.PillName = row["PillName"].ToString();
                }
                if (((row["InoculationDate"] != null) && (row["InoculationDate"] != DBNull.Value)) && (row["InoculationDate"].ToString() != ""))
                {
                    recordsInoculationHistoryModel.InoculationDate = new DateTime?(DateTime.Parse(row["InoculationDate"].ToString()));
                }
                if ((row["InoculationHistory"] != null) && (row["InoculationHistory"] != DBNull.Value))
                {
                    recordsInoculationHistoryModel.InoculationHistory = row["InoculationHistory"].ToString();
                }
            }
            return(recordsInoculationHistoryModel);
        }
        public int AddServer(RecordsInoculationHistoryModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into ARCHIVE_INOCULATIONHISTORY(");
            builder.Append("PhysicalID,IDCardNo,PillName,InoculationDate,InoculationHistory,OutKey)");
            builder.Append(" values (");
            builder.Append("@PhysicalID,@IDCardNo,@PillName,@InoculationDate,@InoculationHistory,@OutKey)");
            builder.Append(";select @@IDENTITY");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@PillName", MySqlDbType.String, 100),
                new MySqlParameter("@InoculationDate", MySqlDbType.Date),
                new MySqlParameter("@InoculationHistory", MySqlDbType.String, 100),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 4)
            };
            cmdParms[0].Value = model.PhysicalID;
            cmdParms[1].Value = model.IDCardNo;
            cmdParms[2].Value = model.PillName;
            cmdParms[3].Value = model.InoculationDate;
            cmdParms[4].Value = model.InoculationHistory;
            cmdParms[5].Value = model.OutKey;
            object single = MySQLHelper.GetSingleServer(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }
            return(Convert.ToInt32(single));
        }
        public bool UpdateServer(RecordsInoculationHistoryModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update ARCHIVE_INOCULATIONHISTORY set ");
            builder.Append("PhysicalID=@PhysicalID,");
            builder.Append("IDCardNo=@IDCardNo,");
            builder.Append("PillName=@PillName,");
            builder.Append("InoculationDate=@InoculationDate,");
            builder.Append("InoculationHistory=@InoculationHistory");
            builder.Append(" where IDCardNo=@IDCardNo");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@PillName", MySqlDbType.String, 100),
                new MySqlParameter("@InoculationDate", MySqlDbType.Date),
                new MySqlParameter("@InoculationHistory", MySqlDbType.String, 100),
                //new MySqlParameter("@ID", MySqlDbType.Int32, 8)
            };
            cmdParms[0].Value = model.PhysicalID;
            cmdParms[1].Value = model.IDCardNo;
            cmdParms[2].Value = model.PillName;
            cmdParms[3].Value = model.InoculationDate;
            cmdParms[4].Value = model.InoculationHistory;
            //cmdParms[5].Value = model.ID;
            return(MySQLHelper.ExecuteSqlServer(builder.ToString(), cmdParms) > 0);
        }
        public List <RecordsInoculationHistoryModel> DataTableToList(DataTable dt)
        {
            List <RecordsInoculationHistoryModel> list = new List <RecordsInoculationHistoryModel>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    RecordsInoculationHistoryModel item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
Exemple #5
0
        public bool Add(RecordsInoculationHistoryModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("INSERT INTO ARCHIVE_INOCULATIONHISTORY(");
            builder.Append("PhysicalID,IDCardNo,PillName,InoculationDate,InoculationHistory,OutKey)");
            builder.Append(" VALUES (");
            builder.Append("@PhysicalID,@IDCardNo,@PillName,@InoculationDate,@InoculationHistory,@OutKey)");

            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@PhysicalID", MySqlDbType.String, 8),
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 21),
                new MySqlParameter("@PillName", MySqlDbType.String, 100),
                new MySqlParameter("@InoculationDate", MySqlDbType.Date),
                new MySqlParameter("@InoculationHistory", MySqlDbType.String, 100),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 4)
            };

            cmdParms[0].Value = model.PhysicalID;
            cmdParms[1].Value = model.IDCardNo;
            cmdParms[2].Value = model.PillName;
            cmdParms[3].Value = model.InoculationDate;
            cmdParms[4].Value = model.InoculationHistory;
            cmdParms[5].Value = model.OutKey;

            int rows = MySQLHelper.ExecuteSql(builder.ToString(), cmdParms);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 public int AddServer(RecordsInoculationHistoryModel model)
 {
     return(this.dal.AddServer(model));
 }
 public bool UpdateServer(RecordsInoculationHistoryModel model)
 {
     return(this.dal.UpdateServer(model));
 }
Exemple #8
0
 public bool Add(RecordsInoculationHistoryModel model)
 {
     return(this.dal.Add(model));
 }