示例#1
0
        public bool Update(RecordsHyperSurveyModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("update ARCHIVE_HYPER_SURVEY set ");
            builder.Append("IDCardNo=@IDCardNo,");
            builder.Append("EatPersonSum=@EatPersonSum,");
            builder.Append("EatChildSum=@EatChildSum,");
            builder.Append("EatSaltQuantity=@EatSaltQuantity,");
            builder.Append("EatSoyQuntity=@EatSoyQuntity, ");
            builder.Append("OutKey=@OutKey ");
            builder.Append(" where ID=@ID ");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            { new MySqlParameter("@IDCardNo", MySqlDbType.String, 18),
              new MySqlParameter("@EatPersonSum", MySqlDbType.Int32),
              new MySqlParameter("@EatChildSum", MySqlDbType.Int32),
              new MySqlParameter("@EatSaltQuantity", MySqlDbType.Decimal),
              new MySqlParameter("@EatSoyQuntity", MySqlDbType.Decimal),
              new MySqlParameter("@OutKey", MySqlDbType.Int32, 4),
              new MySqlParameter("@ID", MySqlDbType.Int32, 8) };
            cmdParms[0].Value = model.IDCardNo;
            cmdParms[1].Value = model.EatPersonSum;
            cmdParms[2].Value = model.EatChildSum;
            cmdParms[3].Value = model.EatSaltQuantity;
            cmdParms[4].Value = model.EatSoyQuntity;
            cmdParms[5].Value = model.OutKey;
            cmdParms[6].Value = model.ID;
            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
示例#2
0
        public int Add(RecordsHyperSurveyModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("insert into ARCHIVE_HYPER_SURVEY(");
            builder.Append("IDCardNo,EatPersonSum,EatChildSum,EatSaltQuantity,EatSoyQuntity,OutKey )");
            builder.Append(" values (");
            builder.Append("@IDCardNo,@EatPersonSum,@EatChildSum,@EatSaltQuantity,@EatSoyQuntity,@OutKey )");
            builder.Append(";select @@IDENTITY");
            MySqlParameter[] cmdParms = new MySqlParameter[]
            {
                new MySqlParameter("@IDCardNo", MySqlDbType.String, 18),
                new MySqlParameter("@EatPersonSum", MySqlDbType.Int32),
                new MySqlParameter("@EatChildSum", MySqlDbType.Int32),
                new MySqlParameter("@EatSaltQuantity", MySqlDbType.Decimal),
                new MySqlParameter("@EatSoyQuntity", MySqlDbType.Decimal),
                new MySqlParameter("@OutKey", MySqlDbType.Int32, 4)
            };
            cmdParms[0].Value = model.IDCardNo;
            cmdParms[1].Value = model.EatPersonSum;
            cmdParms[2].Value = model.EatChildSum;
            cmdParms[3].Value = model.EatSaltQuantity;
            cmdParms[4].Value = model.EatSoyQuntity;
            cmdParms[5].Value = model.OutKey;
            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }
            return(Convert.ToInt32(single));
        }
        public List <RecordsHyperSurveyModel> DataTableToList(DataTable dt)
        {
            List <RecordsHyperSurveyModel> list = new List <RecordsHyperSurveyModel>();
            int count = dt.Rows.Count;

            if (count > 0)
            {
                for (int i = 0; i < count; i++)
                {
                    RecordsHyperSurveyModel item = this.dal.DataRowToModel(dt.Rows[i]);
                    if (item != null)
                    {
                        list.Add(item);
                    }
                }
            }
            return(list);
        }
示例#4
0
        public RecordsHyperSurveyModel DataRowToModel(DataRow row)
        {
            RecordsHyperSurveyModel HyperSurveyModel = new RecordsHyperSurveyModel();

            if (row != null)
            {
                if (((row["ID"] != null) && (row["ID"] != DBNull.Value)) && (row["ID"].ToString() != ""))
                {
                    HyperSurveyModel.ID = int.Parse(row["ID"].ToString());
                }
                if ((row["IDCardNo"] != null) && (row["IDCardNo"] != DBNull.Value))
                {
                    HyperSurveyModel.IDCardNo = row["IDCardNo"].ToString();
                }

                if (((row["EatPersonSum"] != null) && (row["EatPersonSum"] != DBNull.Value)) && (row["EatPersonSum"].ToString() != ""))
                {
                    HyperSurveyModel.EatPersonSum = new int?(int.Parse(row["EatPersonSum"].ToString()));
                }
                if (((row["EatChildSum"] != null) && (row["EatChildSum"] != DBNull.Value)) && (row["EatChildSum"].ToString() != ""))
                {
                    HyperSurveyModel.EatChildSum = new int?(int.Parse(row["EatChildSum"].ToString()));
                }

                if (((row["EatSaltQuantity"] != null) && (row["EatSaltQuantity"] != DBNull.Value)) && (row["EatSaltQuantity"].ToString() != ""))
                {
                    HyperSurveyModel.EatSaltQuantity = new decimal?(decimal.Parse(row["EatSaltQuantity"].ToString()));
                }
                if (((row["EatSoyQuntity"] != null) && (row["EatSoyQuntity"] != DBNull.Value)) && (row["EatSoyQuntity"].ToString() != ""))
                {
                    HyperSurveyModel.EatSoyQuntity = new decimal?(decimal.Parse(row["EatSoyQuntity"].ToString()));
                }
                if (((row["OutKey"] != null) && (row["OutKey"] != DBNull.Value)) && (row["OutKey"].ToString() != ""))
                {
                    HyperSurveyModel.OutKey = int.Parse(row["OutKey"].ToString());
                }
            }
            return(HyperSurveyModel);
        }
示例#5
0
        public void InitEveryThing()
        {
            this.HyperSurveyModel = new RecordsHyperSurveyBLL().GetModel(PhysicalInfoFactory.ID);
            this.HyperFoodsModel  = new RecordsHyperFoodsBLL().GetModelList(string.Format("IDCardNo = '{0}' and OutKey={1}", this.Model.IDCardNo, PhysicalInfoFactory.ID));
            if (this.HyperSurveyModel == null)
            {
                HyperSurveyModel          = new RecordsHyperSurveyModel();
                HyperSurveyModel.IDCardNo = Model.IDCardNo;
            }

            this.tbName.Text = Model.CustomerName;

            this.bindingManagersurvey = new SimpleBindingManager <RecordsHyperSurveyModel>(this.inputRangessurvey, this.inputrange_str, this.HyperSurveyModel);
            this.bindingManagersurvey.SimpleBindingInt(this.txbPersonSum, "EatPersonSum", true);
            this.bindingManagersurvey.SimpleBindingInt(this.txbPersonChild, "EatChildSum", true);
            this.bindingManagersurvey.SimpleBinding(this.txbSalt, "EatSaltQuantity", true);
            this.bindingManagersurvey.SimpleBinding(this.txbSoy, "EatSoyQuntity", true);

            for (int k = 0; k < this.foodControl.Count; k++)
            {
                if (k < HyperFoodsModel.Count)
                {
                    switch (HyperFoodsModel[k].FoodName)
                    {
                    case "咸蛋": this.foodControl[0].Source = this.HyperFoodsModel[k]; break;

                    case "咸鱼": this.foodControl[1].Source = this.HyperFoodsModel[k]; break;

                    case "虾皮": this.foodControl[2].Source = this.HyperFoodsModel[k]; break;

                    case "虾米": this.foodControl[3].Source = this.HyperFoodsModel[k]; break;

                    case "方便面": this.foodControl[4].Source = this.HyperFoodsModel[k]; break;

                    case "豆腐乳": this.foodControl[5].Source = this.HyperFoodsModel[k]; break;

                    case "咸菜": this.foodControl[6].Source = this.HyperFoodsModel[k]; break;

                    case "辣椒酱": this.foodControl[7].Source = this.HyperFoodsModel[k]; break;

                    case "虾酱": this.foodControl[8].Source = this.HyperFoodsModel[k]; break;

                    case "甜面酱": this.foodControl[9].Source = this.HyperFoodsModel[k]; break;

                    case "豆瓣酱": this.foodControl[10].Source = this.HyperFoodsModel[k]; break;

                    default: break;
                    }
                }
            }
            for (int k = 0; k < this.foodControl.Count; k++)
            {
                if (this.foodControl[k].Source == null)
                {
                    RecordsHyperFoodsModel recordsHyperFoodsModel = new RecordsHyperFoodsModel
                    {
                        IDCardNo   = this.Model.IDCardNo,
                        ModelState = RecordsStateModel.AddToDB
                    };
                    this.foodControl[k].Source = recordsHyperFoodsModel;
                }
                else
                {
                    this.foodControl[k].Source.ModelState = RecordsStateModel.UpdateInDB;
                }
            }

            this.EveryThingIsOk = true;
        }
 public bool Update(RecordsHyperSurveyModel model)
 {
     return(this.dal.Update(model));
 }
 public int Add(RecordsHyperSurveyModel model)
 {
     return(this.dal.Add(model));
 }