Beispiel #1
0
 private void ShowInfo(int TID)
 {
     WebDemo.BLL.WebDemo.OperationTotal   bll   = new WebDemo.BLL.WebDemo.OperationTotal();
     WebDemo.Model.WebDemo.OperationTotal model = bll.GetModel(TID);
     this.lblTID.Text           = model.TID.ToString();
     this.txtMeterID.Text       = model.MeterID.ToString();
     this.txtPayID.Text         = model.PayID.ToString();
     this.txtBeginMonth.Text    = model.BeginMonth;
     this.txtBeginNumber.Text   = model.BeginNumber.ToString();
     this.txtEndMonth.Text      = model.EndMonth;
     this.txtEndNumber.Text     = model.EndNumber.ToString();
     this.txtUseNumber.Text     = model.UseNumber.ToString();
     this.txtPriceTypeID.Text   = model.PriceTypeID.ToString();
     this.txtPriceTypeName.Text = model.PriceTypeName;
     this.txtPrice.Text         = model.Price.ToString();
     this.txtPrice2.Text        = model.Price2.ToString();
     this.txtPrice3.Text        = model.Price3.ToString();
     this.txtFareMoney.Text     = model.FareMoney.ToString();
     this.txtPayMark.Text       = model.PayMark.ToString();
     this.txtOperType.Text      = model.OperType.ToString();
     this.txtOperDate.Text      = model.OperDate.ToString();
     this.txtOperatorID.Text    = model.OperatorID.ToString();
     this.txtopermonth.Text     = model.opermonth;
     this.txtPriceUnit.Text     = model.PriceUnit;
     this.txtOperationName.Text = model.OperationName;
     this.txtDivid1.Text        = model.Divid1.ToString();
     this.txtDivid2.Text        = model.Divid2.ToString();
     this.txtUseNumber1.Text    = model.UseNumber1.ToString();
     this.txtUseNumber2.Text    = model.UseNumber2.ToString();
     this.txtUseNumber3.Text    = model.UseNumber3.ToString();
     this.txtAdditionNum.Text   = model.AdditionNum.ToString();
 }
Beispiel #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public WebDemo.Model.WebDemo.OperationTotal GetModel(int TID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 TID,MeterID,PayID,BeginMonth,BeginNumber,EndMonth,EndNumber,UseNumber,PriceTypeID,PriceTypeName,Price,Price2,Price3,FareMoney,PayMark,OperType,OperDate,OperatorID,opermonth,PriceUnit,OperationName,Divid1,Divid2,UseNumber1,UseNumber2,UseNumber3,AdditionNum from OperationTotal ");
            strSql.Append(" where TID=@TID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TID", SqlDbType.Int, 4)
            };
            parameters[0].Value = TID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(WebDemo.Model.WebDemo.OperationTotal model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into OperationTotal(");
            strSql.Append("TID,MeterID,PayID,BeginMonth,BeginNumber,EndMonth,EndNumber,UseNumber,PriceTypeID,PriceTypeName,Price,Price2,Price3,FareMoney,PayMark,OperType,OperDate,OperatorID,opermonth,PriceUnit,OperationName,Divid1,Divid2,UseNumber1,UseNumber2,UseNumber3,AdditionNum)");
            strSql.Append(" values (");
            strSql.Append("@TID,@MeterID,@PayID,@BeginMonth,@BeginNumber,@EndMonth,@EndNumber,@UseNumber,@PriceTypeID,@PriceTypeName,@Price,@Price2,@Price3,@FareMoney,@PayMark,@OperType,@OperDate,@OperatorID,@opermonth,@PriceUnit,@OperationName,@Divid1,@Divid2,@UseNumber1,@UseNumber2,@UseNumber3,@AdditionNum)");
            SqlParameter[] parameters =
            {
                new SqlParameter("@TID",           SqlDbType.Int,        4),
                new SqlParameter("@MeterID",       SqlDbType.Int,        4),
                new SqlParameter("@PayID",         SqlDbType.Int,        4),
                new SqlParameter("@BeginMonth",    SqlDbType.VarChar,    7),
                new SqlParameter("@BeginNumber",   SqlDbType.Int,        4),
                new SqlParameter("@EndMonth",      SqlDbType.VarChar,    7),
                new SqlParameter("@EndNumber",     SqlDbType.Int,        4),
                new SqlParameter("@UseNumber",     SqlDbType.Int,        4),
                new SqlParameter("@PriceTypeID",   SqlDbType.Int,        4),
                new SqlParameter("@PriceTypeName", SqlDbType.VarChar,   50),
                new SqlParameter("@Price",         SqlDbType.Decimal,    9),
                new SqlParameter("@Price2",        SqlDbType.Decimal,    9),
                new SqlParameter("@Price3",        SqlDbType.Decimal,    9),
                new SqlParameter("@FareMoney",     SqlDbType.Decimal,    9),
                new SqlParameter("@PayMark",       SqlDbType.Int,        4),
                new SqlParameter("@OperType",      SqlDbType.Int,        4),
                new SqlParameter("@OperDate",      SqlDbType.DateTime),
                new SqlParameter("@OperatorID",    SqlDbType.Int,        4),
                new SqlParameter("@opermonth",     SqlDbType.VarChar,    7),
                new SqlParameter("@PriceUnit",     SqlDbType.VarChar,   50),
                new SqlParameter("@OperationName", SqlDbType.VarChar,   50),
                new SqlParameter("@Divid1",        SqlDbType.Int,        4),
                new SqlParameter("@Divid2",        SqlDbType.Int,        4),
                new SqlParameter("@UseNumber1",    SqlDbType.Decimal,    9),
                new SqlParameter("@UseNumber2",    SqlDbType.Decimal,    9),
                new SqlParameter("@UseNumber3",    SqlDbType.Decimal,    9),
                new SqlParameter("@AdditionNum",   SqlDbType.Decimal, 9)
            };
            parameters[0].Value  = model.TID;
            parameters[1].Value  = model.MeterID;
            parameters[2].Value  = model.PayID;
            parameters[3].Value  = model.BeginMonth;
            parameters[4].Value  = model.BeginNumber;
            parameters[5].Value  = model.EndMonth;
            parameters[6].Value  = model.EndNumber;
            parameters[7].Value  = model.UseNumber;
            parameters[8].Value  = model.PriceTypeID;
            parameters[9].Value  = model.PriceTypeName;
            parameters[10].Value = model.Price;
            parameters[11].Value = model.Price2;
            parameters[12].Value = model.Price3;
            parameters[13].Value = model.FareMoney;
            parameters[14].Value = model.PayMark;
            parameters[15].Value = model.OperType;
            parameters[16].Value = model.OperDate;
            parameters[17].Value = model.OperatorID;
            parameters[18].Value = model.opermonth;
            parameters[19].Value = model.PriceUnit;
            parameters[20].Value = model.OperationName;
            parameters[21].Value = model.Divid1;
            parameters[22].Value = model.Divid2;
            parameters[23].Value = model.UseNumber1;
            parameters[24].Value = model.UseNumber2;
            parameters[25].Value = model.UseNumber3;
            parameters[26].Value = model.AdditionNum;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public WebDemo.Model.WebDemo.OperationTotal DataRowToModel(DataRow row)
 {
     WebDemo.Model.WebDemo.OperationTotal model = new WebDemo.Model.WebDemo.OperationTotal();
     if (row != null)
     {
         if (row["TID"] != null && row["TID"].ToString() != "")
         {
             model.TID = int.Parse(row["TID"].ToString());
         }
         if (row["MeterID"] != null && row["MeterID"].ToString() != "")
         {
             model.MeterID = int.Parse(row["MeterID"].ToString());
         }
         if (row["PayID"] != null && row["PayID"].ToString() != "")
         {
             model.PayID = int.Parse(row["PayID"].ToString());
         }
         if (row["BeginMonth"] != null)
         {
             model.BeginMonth = row["BeginMonth"].ToString();
         }
         if (row["BeginNumber"] != null && row["BeginNumber"].ToString() != "")
         {
             model.BeginNumber = int.Parse(row["BeginNumber"].ToString());
         }
         if (row["EndMonth"] != null)
         {
             model.EndMonth = row["EndMonth"].ToString();
         }
         if (row["EndNumber"] != null && row["EndNumber"].ToString() != "")
         {
             model.EndNumber = int.Parse(row["EndNumber"].ToString());
         }
         if (row["UseNumber"] != null && row["UseNumber"].ToString() != "")
         {
             model.UseNumber = int.Parse(row["UseNumber"].ToString());
         }
         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["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["FareMoney"] != null && row["FareMoney"].ToString() != "")
         {
             model.FareMoney = decimal.Parse(row["FareMoney"].ToString());
         }
         if (row["PayMark"] != null && row["PayMark"].ToString() != "")
         {
             model.PayMark = int.Parse(row["PayMark"].ToString());
         }
         if (row["OperType"] != null && row["OperType"].ToString() != "")
         {
             model.OperType = int.Parse(row["OperType"].ToString());
         }
         if (row["OperDate"] != null && row["OperDate"].ToString() != "")
         {
             model.OperDate = DateTime.Parse(row["OperDate"].ToString());
         }
         if (row["OperatorID"] != null && row["OperatorID"].ToString() != "")
         {
             model.OperatorID = int.Parse(row["OperatorID"].ToString());
         }
         if (row["opermonth"] != null)
         {
             model.opermonth = row["opermonth"].ToString();
         }
         if (row["PriceUnit"] != null)
         {
             model.PriceUnit = row["PriceUnit"].ToString();
         }
         if (row["OperationName"] != null)
         {
             model.OperationName = row["OperationName"].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["UseNumber1"] != null && row["UseNumber1"].ToString() != "")
         {
             model.UseNumber1 = decimal.Parse(row["UseNumber1"].ToString());
         }
         if (row["UseNumber2"] != null && row["UseNumber2"].ToString() != "")
         {
             model.UseNumber2 = decimal.Parse(row["UseNumber2"].ToString());
         }
         if (row["UseNumber3"] != null && row["UseNumber3"].ToString() != "")
         {
             model.UseNumber3 = decimal.Parse(row["UseNumber3"].ToString());
         }
         if (row["AdditionNum"] != null && row["AdditionNum"].ToString() != "")
         {
             model.AdditionNum = decimal.Parse(row["AdditionNum"].ToString());
         }
     }
     return(model);
 }
Beispiel #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(WebDemo.Model.WebDemo.OperationTotal model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update OperationTotal set ");
            strSql.Append("MeterID=@MeterID,");
            strSql.Append("PayID=@PayID,");
            strSql.Append("BeginMonth=@BeginMonth,");
            strSql.Append("BeginNumber=@BeginNumber,");
            strSql.Append("EndMonth=@EndMonth,");
            strSql.Append("EndNumber=@EndNumber,");
            strSql.Append("UseNumber=@UseNumber,");
            strSql.Append("PriceTypeID=@PriceTypeID,");
            strSql.Append("PriceTypeName=@PriceTypeName,");
            strSql.Append("Price=@Price,");
            strSql.Append("Price2=@Price2,");
            strSql.Append("Price3=@Price3,");
            strSql.Append("FareMoney=@FareMoney,");
            strSql.Append("PayMark=@PayMark,");
            strSql.Append("OperType=@OperType,");
            strSql.Append("OperDate=@OperDate,");
            strSql.Append("OperatorID=@OperatorID,");
            strSql.Append("opermonth=@opermonth,");
            strSql.Append("PriceUnit=@PriceUnit,");
            strSql.Append("OperationName=@OperationName,");
            strSql.Append("Divid1=@Divid1,");
            strSql.Append("Divid2=@Divid2,");
            strSql.Append("UseNumber1=@UseNumber1,");
            strSql.Append("UseNumber2=@UseNumber2,");
            strSql.Append("UseNumber3=@UseNumber3,");
            strSql.Append("AdditionNum=@AdditionNum");
            strSql.Append(" where TID=@TID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@MeterID",       SqlDbType.Int,        4),
                new SqlParameter("@PayID",         SqlDbType.Int,        4),
                new SqlParameter("@BeginMonth",    SqlDbType.VarChar,    7),
                new SqlParameter("@BeginNumber",   SqlDbType.Int,        4),
                new SqlParameter("@EndMonth",      SqlDbType.VarChar,    7),
                new SqlParameter("@EndNumber",     SqlDbType.Int,        4),
                new SqlParameter("@UseNumber",     SqlDbType.Int,        4),
                new SqlParameter("@PriceTypeID",   SqlDbType.Int,        4),
                new SqlParameter("@PriceTypeName", SqlDbType.VarChar,   50),
                new SqlParameter("@Price",         SqlDbType.Decimal,    9),
                new SqlParameter("@Price2",        SqlDbType.Decimal,    9),
                new SqlParameter("@Price3",        SqlDbType.Decimal,    9),
                new SqlParameter("@FareMoney",     SqlDbType.Decimal,    9),
                new SqlParameter("@PayMark",       SqlDbType.Int,        4),
                new SqlParameter("@OperType",      SqlDbType.Int,        4),
                new SqlParameter("@OperDate",      SqlDbType.DateTime),
                new SqlParameter("@OperatorID",    SqlDbType.Int,        4),
                new SqlParameter("@opermonth",     SqlDbType.VarChar,    7),
                new SqlParameter("@PriceUnit",     SqlDbType.VarChar,   50),
                new SqlParameter("@OperationName", SqlDbType.VarChar,   50),
                new SqlParameter("@Divid1",        SqlDbType.Int,        4),
                new SqlParameter("@Divid2",        SqlDbType.Int,        4),
                new SqlParameter("@UseNumber1",    SqlDbType.Decimal,    9),
                new SqlParameter("@UseNumber2",    SqlDbType.Decimal,    9),
                new SqlParameter("@UseNumber3",    SqlDbType.Decimal,    9),
                new SqlParameter("@AdditionNum",   SqlDbType.Decimal,    9),
                new SqlParameter("@TID",           SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.MeterID;
            parameters[1].Value  = model.PayID;
            parameters[2].Value  = model.BeginMonth;
            parameters[3].Value  = model.BeginNumber;
            parameters[4].Value  = model.EndMonth;
            parameters[5].Value  = model.EndNumber;
            parameters[6].Value  = model.UseNumber;
            parameters[7].Value  = model.PriceTypeID;
            parameters[8].Value  = model.PriceTypeName;
            parameters[9].Value  = model.Price;
            parameters[10].Value = model.Price2;
            parameters[11].Value = model.Price3;
            parameters[12].Value = model.FareMoney;
            parameters[13].Value = model.PayMark;
            parameters[14].Value = model.OperType;
            parameters[15].Value = model.OperDate;
            parameters[16].Value = model.OperatorID;
            parameters[17].Value = model.opermonth;
            parameters[18].Value = model.PriceUnit;
            parameters[19].Value = model.OperationName;
            parameters[20].Value = model.Divid1;
            parameters[21].Value = model.Divid2;
            parameters[22].Value = model.UseNumber1;
            parameters[23].Value = model.UseNumber2;
            parameters[24].Value = model.UseNumber3;
            parameters[25].Value = model.AdditionNum;
            parameters[26].Value = model.TID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Beispiel #6
0
        public void btnSave_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (!PageValidate.IsNumber(txtMeterID.Text))
            {
                strErr += "MeterID格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPayID.Text))
            {
                strErr += "PayID格式错误!\\n";
            }
            if (this.txtBeginMonth.Text.Trim().Length == 0)
            {
                strErr += "BeginMonth不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtBeginNumber.Text))
            {
                strErr += "BeginNumber格式错误!\\n";
            }
            if (this.txtEndMonth.Text.Trim().Length == 0)
            {
                strErr += "EndMonth不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtEndNumber.Text))
            {
                strErr += "EndNumber格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtUseNumber.Text))
            {
                strErr += "UseNumber格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPriceTypeID.Text))
            {
                strErr += "PriceTypeID格式错误!\\n";
            }
            if (this.txtPriceTypeName.Text.Trim().Length == 0)
            {
                strErr += "PriceTypeName不能为空!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice.Text))
            {
                strErr += "Price格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice2.Text))
            {
                strErr += "Price2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtPrice3.Text))
            {
                strErr += "Price3格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtFareMoney.Text))
            {
                strErr += "总金额格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtPayMark.Text))
            {
                strErr += "PayMark格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtOperType.Text))
            {
                strErr += "1-抄表结算;2-换表结算;格式错误!\\n";
            }
            if (!PageValidate.IsDateTime(txtOperDate.Text))
            {
                strErr += "OperDate格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtOperatorID.Text))
            {
                strErr += "OperatorID格式错误!\\n";
            }
            if (this.txtopermonth.Text.Trim().Length == 0)
            {
                strErr += "opermonth不能为空!\\n";
            }
            if (this.txtPriceUnit.Text.Trim().Length == 0)
            {
                strErr += "PriceUnit不能为空!\\n";
            }
            if (this.txtOperationName.Text.Trim().Length == 0)
            {
                strErr += "OperationName不能为空!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid1.Text))
            {
                strErr += "Divid1格式错误!\\n";
            }
            if (!PageValidate.IsNumber(txtDivid2.Text))
            {
                strErr += "Divid2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseNumber1.Text))
            {
                strErr += "UseNumber1格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseNumber2.Text))
            {
                strErr += "UseNumber2格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtUseNumber3.Text))
            {
                strErr += "UseNumber3格式错误!\\n";
            }
            if (!PageValidate.IsDecimal(txtAdditionNum.Text))
            {
                strErr += "AdditionNum格式错误!\\n";
            }

            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }
            int      TID           = int.Parse(this.lblTID.Text);
            int      MeterID       = int.Parse(this.txtMeterID.Text);
            int      PayID         = int.Parse(this.txtPayID.Text);
            string   BeginMonth    = this.txtBeginMonth.Text;
            int      BeginNumber   = int.Parse(this.txtBeginNumber.Text);
            string   EndMonth      = this.txtEndMonth.Text;
            int      EndNumber     = int.Parse(this.txtEndNumber.Text);
            int      UseNumber     = int.Parse(this.txtUseNumber.Text);
            int      PriceTypeID   = int.Parse(this.txtPriceTypeID.Text);
            string   PriceTypeName = this.txtPriceTypeName.Text;
            decimal  Price         = decimal.Parse(this.txtPrice.Text);
            decimal  Price2        = decimal.Parse(this.txtPrice2.Text);
            decimal  Price3        = decimal.Parse(this.txtPrice3.Text);
            decimal  FareMoney     = decimal.Parse(this.txtFareMoney.Text);
            int      PayMark       = int.Parse(this.txtPayMark.Text);
            int      OperType      = int.Parse(this.txtOperType.Text);
            DateTime OperDate      = DateTime.Parse(this.txtOperDate.Text);
            int      OperatorID    = int.Parse(this.txtOperatorID.Text);
            string   opermonth     = this.txtopermonth.Text;
            string   PriceUnit     = this.txtPriceUnit.Text;
            string   OperationName = this.txtOperationName.Text;
            int      Divid1        = int.Parse(this.txtDivid1.Text);
            int      Divid2        = int.Parse(this.txtDivid2.Text);
            decimal  UseNumber1    = decimal.Parse(this.txtUseNumber1.Text);
            decimal  UseNumber2    = decimal.Parse(this.txtUseNumber2.Text);
            decimal  UseNumber3    = decimal.Parse(this.txtUseNumber3.Text);
            decimal  AdditionNum   = decimal.Parse(this.txtAdditionNum.Text);


            WebDemo.Model.WebDemo.OperationTotal model = new WebDemo.Model.WebDemo.OperationTotal();
            model.TID           = TID;
            model.MeterID       = MeterID;
            model.PayID         = PayID;
            model.BeginMonth    = BeginMonth;
            model.BeginNumber   = BeginNumber;
            model.EndMonth      = EndMonth;
            model.EndNumber     = EndNumber;
            model.UseNumber     = UseNumber;
            model.PriceTypeID   = PriceTypeID;
            model.PriceTypeName = PriceTypeName;
            model.Price         = Price;
            model.Price2        = Price2;
            model.Price3        = Price3;
            model.FareMoney     = FareMoney;
            model.PayMark       = PayMark;
            model.OperType      = OperType;
            model.OperDate      = OperDate;
            model.OperatorID    = OperatorID;
            model.opermonth     = opermonth;
            model.PriceUnit     = PriceUnit;
            model.OperationName = OperationName;
            model.Divid1        = Divid1;
            model.Divid2        = Divid2;
            model.UseNumber1    = UseNumber1;
            model.UseNumber2    = UseNumber2;
            model.UseNumber3    = UseNumber3;
            model.AdditionNum   = AdditionNum;

            WebDemo.BLL.WebDemo.OperationTotal bll = new WebDemo.BLL.WebDemo.OperationTotal();
            bll.Update(model);
            Maticsoft.Common.MessageBox.ShowAndRedirect(this, "保存成功!", "list.aspx");
        }