Example #1
0
 private void ShowInfo(int PriceTypeID)
 {
     WebDemo.BLL.WebDemo.PriceType   bll   = new WebDemo.BLL.WebDemo.PriceType();
     WebDemo.Model.WebDemo.PriceType model = bll.GetModel(PriceTypeID);
     this.lblPriceTypeID.Text    = model.PriceTypeID.ToString();
     this.lblPriceTypeName.Text  = model.PriceTypeName;
     this.lblMeterTypeID.Text    = model.MeterTypeID.ToString();
     this.lblPriceNo.Text        = model.PriceNo.ToString();
     this.lblPrice.Text          = model.Price.ToString();
     this.lblPrice2.Text         = model.Price2.ToString();
     this.lblPrice3.Text         = model.Price3.ToString();
     this.lblDivid1.Text         = model.Divid1.ToString();
     this.lblDivid2.Text         = model.Divid2.ToString();
     this.lblPriceUnit.Text      = model.PriceUnit;
     this.lblRemark.Text         = model.Remark;
     this.lblPrice4.Text         = model.Price4.ToString();
     this.lblPrice5.Text         = model.Price5.ToString();
     this.lblPrice6.Text         = model.Price6.ToString();
     this.lblDivid3.Text         = model.Divid3.ToString();
     this.lblDivid4.Text         = model.Divid4.ToString();
     this.lblDivid5.Text         = model.Divid5.ToString();
     this.lblExeDate.Text        = model.ExeDate.ToString();
     this.lblSetNo.Text          = model.SetNo.ToString();
     this.lblSuiteNo.Text        = model.SuiteNo.ToString();
     this.lblGroupPriceNo.Text   = model.GroupPriceNo.ToString();
     this.lblPriceTypeCode.Text  = model.PriceTypeCode;
     this.lblIsStartStar.Text    = model.IsStartStar.ToString();
     this.lblIsStartPeople.Text  = model.IsStartPeople.ToString();
     this.lblPeopleCheck.Text    = model.PeopleCheck.ToString();
     this.lblMaxPeople.Text      = model.MaxPeople.ToString();
     this.lblAddUseNumber.Text   = model.AddUseNumber.ToString();
     this.lblStarsLevel.Text     = model.StarsLevel.ToString();
     this.lblStarsPeriod.Text    = model.StarsPeriod.ToString();
     this.lblStarsCorrected.Text = model.StarsCorrected.ToString();
     this.lblIsStartArea.Text    = model.IsStartArea.ToString();
     this.lblCoefficient.Text    = model.Coefficient.ToString();
     this.lblCalculateDay.Text   = model.CalculateDay.ToString();
     this.lblStarsAreaWay.Text   = model.StarsAreaWay.ToString();
     this.lblStarsByUser.Text    = model.StarsByUser.ToString();
 }
Example #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.PriceType GetModel(int PriceTypeID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 PriceTypeID,PriceTypeName,MeterTypeID,PriceNo,Price,Price2,Price3,Divid1,Divid2,PriceUnit,Remark,Price4,Price5,Price6,Divid3,Divid4,Divid5,ExeDate,SetNo,SuiteNo,GroupPriceNo,PriceTypeCode,IsStartStar,IsStartPeople,PeopleCheck,MaxPeople,AddUseNumber,StarsLevel,StarsPeriod,StarsCorrected,IsStartArea,Coefficient,CalculateDay,StarsAreaWay,StarsByUser from PriceType ");
            strSql.Append(" where PriceTypeID=@PriceTypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PriceTypeID", SqlDbType.Int, 4)
            };
            parameters[0].Value = PriceTypeID;

            WebDemo.Model.WebDemo.PriceType model = new WebDemo.Model.WebDemo.PriceType();
            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Example #3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.txtPriceTypeName.Text.Trim().Length == 0)
            {
                strErr += "价格名称不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtMeterTypeID.Text))
            {
                strErr += "表类型编号格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPriceNo.Text))
            {
                strErr += "程序控制格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice.Text))
            {
                strErr += "单价格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice2.Text))
            {
                strErr += "单价2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice3.Text))
            {
                strErr += "单价3格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid1.Text))
            {
                strErr += "分界点1格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid2.Text))
            {
                strErr += "分界点2格式错误!\\n";
            }
            if (this.txtPriceUnit.Text.Trim().Length == 0)
            {
                strErr += "PriceUnit不能为空!\\n";
            }
            if (this.txtRemark.Text.Trim().Length == 0)
            {
                strErr += "备注信息不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice4.Text))
            {
                strErr += "Price4格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice5.Text))
            {
                strErr += "Price5格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice6.Text))
            {
                strErr += "Price6格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid3.Text))
            {
                strErr += "Divid3格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid4.Text))
            {
                strErr += "Divid4格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid5.Text))
            {
                strErr += "Divid5格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtExeDate.Text))
            {
                strErr += "ExeDate格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtSetNo.Text))
            {
                strErr += "SetNo格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtSuiteNo.Text))
            {
                strErr += "SuiteNo格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtGroupPriceNo.Text))
            {
                strErr += "GroupPriceNo格式错误!\\n";
            }
            if (this.txtPriceTypeCode.Text.Trim().Length == 0)
            {
                strErr += "PriceTypeCode不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtIsStartStar.Text))
            {
                strErr += "IsStartStar格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtIsStartPeople.Text))
            {
                strErr += "IsStartPeople格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPeopleCheck.Text))
            {
                strErr += "PeopleCheck格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtMaxPeople.Text))
            {
                strErr += "MaxPeople格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtAddUseNumber.Text))
            {
                strErr += "AddUseNumber格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStarsLevel.Text))
            {
                strErr += "StarsLevel格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStarsPeriod.Text))
            {
                strErr += "StarsPeriod格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStarsCorrected.Text))
            {
                strErr += "StarsCorrected格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtIsStartArea.Text))
            {
                strErr += "IsStartArea格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtCoefficient.Text))
            {
                strErr += "Coefficient格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtCalculateDay.Text))
            {
                strErr += "CalculateDay格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStarsAreaWay.Text))
            {
                strErr += "StarsAreaWay格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtStarsByUser.Text))
            {
                strErr += "StarsByUser格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            string   PriceTypeName  = this.txtPriceTypeName.Text;
            int      MeterTypeID    = int.Parse(this.txtMeterTypeID.Text);
            int      PriceNo        = int.Parse(this.txtPriceNo.Text);
            decimal  Price          = decimal.Parse(this.txtPrice.Text);
            decimal  Price2         = decimal.Parse(this.txtPrice2.Text);
            decimal  Price3         = decimal.Parse(this.txtPrice3.Text);
            int      Divid1         = int.Parse(this.txtDivid1.Text);
            int      Divid2         = int.Parse(this.txtDivid2.Text);
            string   PriceUnit      = this.txtPriceUnit.Text;
            string   Remark         = this.txtRemark.Text;
            decimal  Price4         = decimal.Parse(this.txtPrice4.Text);
            decimal  Price5         = decimal.Parse(this.txtPrice5.Text);
            decimal  Price6         = decimal.Parse(this.txtPrice6.Text);
            int      Divid3         = int.Parse(this.txtDivid3.Text);
            int      Divid4         = int.Parse(this.txtDivid4.Text);
            int      Divid5         = int.Parse(this.txtDivid5.Text);
            DateTime ExeDate        = DateTime.Parse(this.txtExeDate.Text);
            int      SetNo          = int.Parse(this.txtSetNo.Text);
            int      SuiteNo        = int.Parse(this.txtSuiteNo.Text);
            int      GroupPriceNo   = int.Parse(this.txtGroupPriceNo.Text);
            string   PriceTypeCode  = this.txtPriceTypeCode.Text;
            int      IsStartStar    = int.Parse(this.txtIsStartStar.Text);
            int      IsStartPeople  = int.Parse(this.txtIsStartPeople.Text);
            int      PeopleCheck    = int.Parse(this.txtPeopleCheck.Text);
            int      MaxPeople      = int.Parse(this.txtMaxPeople.Text);
            decimal  AddUseNumber   = decimal.Parse(this.txtAddUseNumber.Text);
            int      StarsLevel     = int.Parse(this.txtStarsLevel.Text);
            int      StarsPeriod    = int.Parse(this.txtStarsPeriod.Text);
            int      StarsCorrected = int.Parse(this.txtStarsCorrected.Text);
            int      IsStartArea    = int.Parse(this.txtIsStartArea.Text);
            decimal  Coefficient    = decimal.Parse(this.txtCoefficient.Text);
            int      CalculateDay   = int.Parse(this.txtCalculateDay.Text);
            int      StarsAreaWay   = int.Parse(this.txtStarsAreaWay.Text);
            int      StarsByUser    = int.Parse(this.txtStarsByUser.Text);

            WebDemo.Model.WebDemo.PriceType model = new WebDemo.Model.WebDemo.PriceType();
            model.PriceTypeName  = PriceTypeName;
            model.MeterTypeID    = MeterTypeID;
            model.PriceNo        = PriceNo;
            model.Price          = Price;
            model.Price2         = Price2;
            model.Price3         = Price3;
            model.Divid1         = Divid1;
            model.Divid2         = Divid2;
            model.PriceUnit      = PriceUnit;
            model.Remark         = Remark;
            model.Price4         = Price4;
            model.Price5         = Price5;
            model.Price6         = Price6;
            model.Divid3         = Divid3;
            model.Divid4         = Divid4;
            model.Divid5         = Divid5;
            model.ExeDate        = ExeDate;
            model.SetNo          = SetNo;
            model.SuiteNo        = SuiteNo;
            model.GroupPriceNo   = GroupPriceNo;
            model.PriceTypeCode  = PriceTypeCode;
            model.IsStartStar    = IsStartStar;
            model.IsStartPeople  = IsStartPeople;
            model.PeopleCheck    = PeopleCheck;
            model.MaxPeople      = MaxPeople;
            model.AddUseNumber   = AddUseNumber;
            model.StarsLevel     = StarsLevel;
            model.StarsPeriod    = StarsPeriod;
            model.StarsCorrected = StarsCorrected;
            model.IsStartArea    = IsStartArea;
            model.Coefficient    = Coefficient;
            model.CalculateDay   = CalculateDay;
            model.StarsAreaWay   = StarsAreaWay;
            model.StarsByUser    = StarsByUser;

            WebDemo.BLL.WebDemo.PriceType bll = new WebDemo.BLL.WebDemo.PriceType();
            bll.Add(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "add.aspx");
        }
Example #4
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(WebDemo.Model.WebDemo.PriceType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into PriceType(");
            strSql.Append("PriceTypeName,MeterTypeID,PriceNo,Price,Price2,Price3,Divid1,Divid2,PriceUnit,Remark,Price4,Price5,Price6,Divid3,Divid4,Divid5,ExeDate,SetNo,SuiteNo,GroupPriceNo,PriceTypeCode,IsStartStar,IsStartPeople,PeopleCheck,MaxPeople,AddUseNumber,StarsLevel,StarsPeriod,StarsCorrected,IsStartArea,Coefficient,CalculateDay,StarsAreaWay,StarsByUser)");
            strSql.Append(" values (");
            strSql.Append("@PriceTypeName,@MeterTypeID,@PriceNo,@Price,@Price2,@Price3,@Divid1,@Divid2,@PriceUnit,@Remark,@Price4,@Price5,@Price6,@Divid3,@Divid4,@Divid5,@ExeDate,@SetNo,@SuiteNo,@GroupPriceNo,@PriceTypeCode,@IsStartStar,@IsStartPeople,@PeopleCheck,@MaxPeople,@AddUseNumber,@StarsLevel,@StarsPeriod,@StarsCorrected,@IsStartArea,@Coefficient,@CalculateDay,@StarsAreaWay,@StarsByUser)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PriceTypeName",  SqlDbType.VarChar,    50),
                new SqlParameter("@MeterTypeID",    SqlDbType.Int,         4),
                new SqlParameter("@PriceNo",        SqlDbType.Int,         4),
                new SqlParameter("@Price",          SqlDbType.Decimal,     9),
                new SqlParameter("@Price2",         SqlDbType.Decimal,     9),
                new SqlParameter("@Price3",         SqlDbType.Decimal,     9),
                new SqlParameter("@Divid1",         SqlDbType.Int,         4),
                new SqlParameter("@Divid2",         SqlDbType.Int,         4),
                new SqlParameter("@PriceUnit",      SqlDbType.VarChar,    50),
                new SqlParameter("@Remark",         SqlDbType.VarChar,   200),
                new SqlParameter("@Price4",         SqlDbType.Decimal,     9),
                new SqlParameter("@Price5",         SqlDbType.Decimal,     9),
                new SqlParameter("@Price6",         SqlDbType.Decimal,     9),
                new SqlParameter("@Divid3",         SqlDbType.Int,         4),
                new SqlParameter("@Divid4",         SqlDbType.Int,         4),
                new SqlParameter("@Divid5",         SqlDbType.Int,         4),
                new SqlParameter("@ExeDate",        SqlDbType.DateTime),
                new SqlParameter("@SetNo",          SqlDbType.Int,         4),
                new SqlParameter("@SuiteNo",        SqlDbType.Int,         4),
                new SqlParameter("@GroupPriceNo",   SqlDbType.Int,         4),
                new SqlParameter("@PriceTypeCode",  SqlDbType.VarChar,   100),
                new SqlParameter("@IsStartStar",    SqlDbType.Int,         4),
                new SqlParameter("@IsStartPeople",  SqlDbType.Int,         4),
                new SqlParameter("@PeopleCheck",    SqlDbType.Int,         4),
                new SqlParameter("@MaxPeople",      SqlDbType.Int,         4),
                new SqlParameter("@AddUseNumber",   SqlDbType.Decimal,     9),
                new SqlParameter("@StarsLevel",     SqlDbType.Int,         4),
                new SqlParameter("@StarsPeriod",    SqlDbType.Int,         4),
                new SqlParameter("@StarsCorrected", SqlDbType.Int,         4),
                new SqlParameter("@IsStartArea",    SqlDbType.Int,         4),
                new SqlParameter("@Coefficient",    SqlDbType.Decimal,     9),
                new SqlParameter("@CalculateDay",   SqlDbType.Int,         4),
                new SqlParameter("@StarsAreaWay",   SqlDbType.Int,         4),
                new SqlParameter("@StarsByUser",    SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PriceTypeName;
            parameters[1].Value  = model.MeterTypeID;
            parameters[2].Value  = model.PriceNo;
            parameters[3].Value  = model.Price;
            parameters[4].Value  = model.Price2;
            parameters[5].Value  = model.Price3;
            parameters[6].Value  = model.Divid1;
            parameters[7].Value  = model.Divid2;
            parameters[8].Value  = model.PriceUnit;
            parameters[9].Value  = model.Remark;
            parameters[10].Value = model.Price4;
            parameters[11].Value = model.Price5;
            parameters[12].Value = model.Price6;
            parameters[13].Value = model.Divid3;
            parameters[14].Value = model.Divid4;
            parameters[15].Value = model.Divid5;
            parameters[16].Value = model.ExeDate;
            parameters[17].Value = model.SetNo;
            parameters[18].Value = model.SuiteNo;
            parameters[19].Value = model.GroupPriceNo;
            parameters[20].Value = model.PriceTypeCode;
            parameters[21].Value = model.IsStartStar;
            parameters[22].Value = model.IsStartPeople;
            parameters[23].Value = model.PeopleCheck;
            parameters[24].Value = model.MaxPeople;
            parameters[25].Value = model.AddUseNumber;
            parameters[26].Value = model.StarsLevel;
            parameters[27].Value = model.StarsPeriod;
            parameters[28].Value = model.StarsCorrected;
            parameters[29].Value = model.IsStartArea;
            parameters[30].Value = model.Coefficient;
            parameters[31].Value = model.CalculateDay;
            parameters[32].Value = model.StarsAreaWay;
            parameters[33].Value = model.StarsByUser;

            object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #5
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.PriceType DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.PriceType model = new WebDemo.Model.WebDemo.PriceType();
     if (row != null)
     {
         if (row["PriceTypeID"] != null && row["PriceTypeID"].ToString() != "")
         {
             model.PriceTypeID = int.Parse(row["PriceTypeID"].ToString());
         }
         if (row["PriceTypeName"] != null)
         {
             model.PriceTypeName = row["PriceTypeName"].ToString();
         }
         if (row["MeterTypeID"] != null && row["MeterTypeID"].ToString() != "")
         {
             model.MeterTypeID = int.Parse(row["MeterTypeID"].ToString());
         }
         if (row["PriceNo"] != null && row["PriceNo"].ToString() != "")
         {
             model.PriceNo = int.Parse(row["PriceNo"].ToString());
         }
         if (row["Price"] != null && row["Price"].ToString() != "")
         {
             model.Price = decimal.Parse(row["Price"].ToString());
         }
         if (row["Price2"] != null && row["Price2"].ToString() != "")
         {
             model.Price2 = decimal.Parse(row["Price2"].ToString());
         }
         if (row["Price3"] != null && row["Price3"].ToString() != "")
         {
             model.Price3 = decimal.Parse(row["Price3"].ToString());
         }
         if (row["Divid1"] != null && row["Divid1"].ToString() != "")
         {
             model.Divid1 = int.Parse(row["Divid1"].ToString());
         }
         if (row["Divid2"] != null && row["Divid2"].ToString() != "")
         {
             model.Divid2 = int.Parse(row["Divid2"].ToString());
         }
         if (row["PriceUnit"] != null)
         {
             model.PriceUnit = row["PriceUnit"].ToString();
         }
         if (row["Remark"] != null)
         {
             model.Remark = row["Remark"].ToString();
         }
         if (row["Price4"] != null && row["Price4"].ToString() != "")
         {
             model.Price4 = decimal.Parse(row["Price4"].ToString());
         }
         if (row["Price5"] != null && row["Price5"].ToString() != "")
         {
             model.Price5 = decimal.Parse(row["Price5"].ToString());
         }
         if (row["Price6"] != null && row["Price6"].ToString() != "")
         {
             model.Price6 = decimal.Parse(row["Price6"].ToString());
         }
         if (row["Divid3"] != null && row["Divid3"].ToString() != "")
         {
             model.Divid3 = int.Parse(row["Divid3"].ToString());
         }
         if (row["Divid4"] != null && row["Divid4"].ToString() != "")
         {
             model.Divid4 = int.Parse(row["Divid4"].ToString());
         }
         if (row["Divid5"] != null && row["Divid5"].ToString() != "")
         {
             model.Divid5 = int.Parse(row["Divid5"].ToString());
         }
         if (row["ExeDate"] != null && row["ExeDate"].ToString() != "")
         {
             model.ExeDate = DateTime.Parse(row["ExeDate"].ToString());
         }
         if (row["SetNo"] != null && row["SetNo"].ToString() != "")
         {
             model.SetNo = int.Parse(row["SetNo"].ToString());
         }
         if (row["SuiteNo"] != null && row["SuiteNo"].ToString() != "")
         {
             model.SuiteNo = int.Parse(row["SuiteNo"].ToString());
         }
         if (row["GroupPriceNo"] != null && row["GroupPriceNo"].ToString() != "")
         {
             model.GroupPriceNo = int.Parse(row["GroupPriceNo"].ToString());
         }
         if (row["PriceTypeCode"] != null)
         {
             model.PriceTypeCode = row["PriceTypeCode"].ToString();
         }
         if (row["IsStartStar"] != null && row["IsStartStar"].ToString() != "")
         {
             model.IsStartStar = int.Parse(row["IsStartStar"].ToString());
         }
         if (row["IsStartPeople"] != null && row["IsStartPeople"].ToString() != "")
         {
             model.IsStartPeople = int.Parse(row["IsStartPeople"].ToString());
         }
         if (row["PeopleCheck"] != null && row["PeopleCheck"].ToString() != "")
         {
             model.PeopleCheck = int.Parse(row["PeopleCheck"].ToString());
         }
         if (row["MaxPeople"] != null && row["MaxPeople"].ToString() != "")
         {
             model.MaxPeople = int.Parse(row["MaxPeople"].ToString());
         }
         if (row["AddUseNumber"] != null && row["AddUseNumber"].ToString() != "")
         {
             model.AddUseNumber = decimal.Parse(row["AddUseNumber"].ToString());
         }
         if (row["StarsLevel"] != null && row["StarsLevel"].ToString() != "")
         {
             model.StarsLevel = int.Parse(row["StarsLevel"].ToString());
         }
         if (row["StarsPeriod"] != null && row["StarsPeriod"].ToString() != "")
         {
             model.StarsPeriod = int.Parse(row["StarsPeriod"].ToString());
         }
         if (row["StarsCorrected"] != null && row["StarsCorrected"].ToString() != "")
         {
             model.StarsCorrected = int.Parse(row["StarsCorrected"].ToString());
         }
         if (row["IsStartArea"] != null && row["IsStartArea"].ToString() != "")
         {
             model.IsStartArea = int.Parse(row["IsStartArea"].ToString());
         }
         if (row["Coefficient"] != null && row["Coefficient"].ToString() != "")
         {
             model.Coefficient = decimal.Parse(row["Coefficient"].ToString());
         }
         if (row["CalculateDay"] != null && row["CalculateDay"].ToString() != "")
         {
             model.CalculateDay = int.Parse(row["CalculateDay"].ToString());
         }
         if (row["StarsAreaWay"] != null && row["StarsAreaWay"].ToString() != "")
         {
             model.StarsAreaWay = int.Parse(row["StarsAreaWay"].ToString());
         }
         if (row["StarsByUser"] != null && row["StarsByUser"].ToString() != "")
         {
             model.StarsByUser = int.Parse(row["StarsByUser"].ToString());
         }
     }
     return(model);
 }
Example #6
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.PriceType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update PriceType set ");
            strSql.Append("PriceTypeName=@PriceTypeName,");
            strSql.Append("MeterTypeID=@MeterTypeID,");
            strSql.Append("PriceNo=@PriceNo,");
            strSql.Append("Price=@Price,");
            strSql.Append("Price2=@Price2,");
            strSql.Append("Price3=@Price3,");
            strSql.Append("Divid1=@Divid1,");
            strSql.Append("Divid2=@Divid2,");
            strSql.Append("PriceUnit=@PriceUnit,");
            strSql.Append("Remark=@Remark,");
            strSql.Append("Price4=@Price4,");
            strSql.Append("Price5=@Price5,");
            strSql.Append("Price6=@Price6,");
            strSql.Append("Divid3=@Divid3,");
            strSql.Append("Divid4=@Divid4,");
            strSql.Append("Divid5=@Divid5,");
            strSql.Append("ExeDate=@ExeDate,");
            strSql.Append("SetNo=@SetNo,");
            strSql.Append("SuiteNo=@SuiteNo,");
            strSql.Append("GroupPriceNo=@GroupPriceNo,");
            strSql.Append("PriceTypeCode=@PriceTypeCode,");
            strSql.Append("IsStartStar=@IsStartStar,");
            strSql.Append("IsStartPeople=@IsStartPeople,");
            strSql.Append("PeopleCheck=@PeopleCheck,");
            strSql.Append("MaxPeople=@MaxPeople,");
            strSql.Append("AddUseNumber=@AddUseNumber,");
            strSql.Append("StarsLevel=@StarsLevel,");
            strSql.Append("StarsPeriod=@StarsPeriod,");
            strSql.Append("StarsCorrected=@StarsCorrected,");
            strSql.Append("IsStartArea=@IsStartArea,");
            strSql.Append("Coefficient=@Coefficient,");
            strSql.Append("CalculateDay=@CalculateDay,");
            strSql.Append("StarsAreaWay=@StarsAreaWay,");
            strSql.Append("StarsByUser=@StarsByUser");
            strSql.Append(" where PriceTypeID=@PriceTypeID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PriceTypeName",  SqlDbType.VarChar,    50),
                new SqlParameter("@MeterTypeID",    SqlDbType.Int,         4),
                new SqlParameter("@PriceNo",        SqlDbType.Int,         4),
                new SqlParameter("@Price",          SqlDbType.Decimal,     9),
                new SqlParameter("@Price2",         SqlDbType.Decimal,     9),
                new SqlParameter("@Price3",         SqlDbType.Decimal,     9),
                new SqlParameter("@Divid1",         SqlDbType.Int,         4),
                new SqlParameter("@Divid2",         SqlDbType.Int,         4),
                new SqlParameter("@PriceUnit",      SqlDbType.VarChar,    50),
                new SqlParameter("@Remark",         SqlDbType.VarChar,   200),
                new SqlParameter("@Price4",         SqlDbType.Decimal,     9),
                new SqlParameter("@Price5",         SqlDbType.Decimal,     9),
                new SqlParameter("@Price6",         SqlDbType.Decimal,     9),
                new SqlParameter("@Divid3",         SqlDbType.Int,         4),
                new SqlParameter("@Divid4",         SqlDbType.Int,         4),
                new SqlParameter("@Divid5",         SqlDbType.Int,         4),
                new SqlParameter("@ExeDate",        SqlDbType.DateTime),
                new SqlParameter("@SetNo",          SqlDbType.Int,         4),
                new SqlParameter("@SuiteNo",        SqlDbType.Int,         4),
                new SqlParameter("@GroupPriceNo",   SqlDbType.Int,         4),
                new SqlParameter("@PriceTypeCode",  SqlDbType.VarChar,   100),
                new SqlParameter("@IsStartStar",    SqlDbType.Int,         4),
                new SqlParameter("@IsStartPeople",  SqlDbType.Int,         4),
                new SqlParameter("@PeopleCheck",    SqlDbType.Int,         4),
                new SqlParameter("@MaxPeople",      SqlDbType.Int,         4),
                new SqlParameter("@AddUseNumber",   SqlDbType.Decimal,     9),
                new SqlParameter("@StarsLevel",     SqlDbType.Int,         4),
                new SqlParameter("@StarsPeriod",    SqlDbType.Int,         4),
                new SqlParameter("@StarsCorrected", SqlDbType.Int,         4),
                new SqlParameter("@IsStartArea",    SqlDbType.Int,         4),
                new SqlParameter("@Coefficient",    SqlDbType.Decimal,     9),
                new SqlParameter("@CalculateDay",   SqlDbType.Int,         4),
                new SqlParameter("@StarsAreaWay",   SqlDbType.Int,         4),
                new SqlParameter("@StarsByUser",    SqlDbType.Int,         4),
                new SqlParameter("@PriceTypeID",    SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PriceTypeName;
            parameters[1].Value  = model.MeterTypeID;
            parameters[2].Value  = model.PriceNo;
            parameters[3].Value  = model.Price;
            parameters[4].Value  = model.Price2;
            parameters[5].Value  = model.Price3;
            parameters[6].Value  = model.Divid1;
            parameters[7].Value  = model.Divid2;
            parameters[8].Value  = model.PriceUnit;
            parameters[9].Value  = model.Remark;
            parameters[10].Value = model.Price4;
            parameters[11].Value = model.Price5;
            parameters[12].Value = model.Price6;
            parameters[13].Value = model.Divid3;
            parameters[14].Value = model.Divid4;
            parameters[15].Value = model.Divid5;
            parameters[16].Value = model.ExeDate;
            parameters[17].Value = model.SetNo;
            parameters[18].Value = model.SuiteNo;
            parameters[19].Value = model.GroupPriceNo;
            parameters[20].Value = model.PriceTypeCode;
            parameters[21].Value = model.IsStartStar;
            parameters[22].Value = model.IsStartPeople;
            parameters[23].Value = model.PeopleCheck;
            parameters[24].Value = model.MaxPeople;
            parameters[25].Value = model.AddUseNumber;
            parameters[26].Value = model.StarsLevel;
            parameters[27].Value = model.StarsPeriod;
            parameters[28].Value = model.StarsCorrected;
            parameters[29].Value = model.IsStartArea;
            parameters[30].Value = model.Coefficient;
            parameters[31].Value = model.CalculateDay;
            parameters[32].Value = model.StarsAreaWay;
            parameters[33].Value = model.StarsByUser;
            parameters[34].Value = model.PriceTypeID;

            int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }