Exemple #1
0
        /// <summary>
        /// 审核分页申请记录
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {
            long iPurchaseID = long.Parse(e.CommandArgument.ToString());

            lgk.Model.tb_Purchase model = purchaseBLL.GetModel(iPurchaseID);
            if (model == null)
            {
                MessageBox.MyShow(this, "该求购信息删除,无法再进行此操作!");
                return;
            }
            if (model.IsPur != 0)
            {
                MessageBox.MyShow(this, "该求购信息已审核,无法再进行此操作!");
                return;
            }
            if (e.CommandName.Equals("Examinat"))//审核
            {
                Response.Redirect("PurchaseExam.aspx?PurchaseID=" + iPurchaseID + "");
            }
            if (e.CommandName.Equals("Remove"))//删除
            {
                if (purchaseBLL.Delete(iPurchaseID))
                {
                    MessageBox.MyShow(this, "删除成功!");
                }
                else
                {
                    MessageBox.MyShow(this, "删除失败!");
                }
            }
            BindData();
        }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public long Add(lgk.Model.tb_Purchase model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_Purchase(");
            strSql.Append("Title,UserID,Amount,Price,Number,Quantity,UnitNum,SaleNum,Charge,PurchaseDate,Remark,IsPur,IsUndo) ");
            strSql.Append("values (");
            strSql.Append("@Title,@UserID,@Amount,@Price,@Number,@Quantity,@UnitNum,@SaleNum,@Charge,@PurchaseDate,@Remark,@IsPur,@IsUndo) ");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@Title",        SqlDbType.VarChar,    60),
                new SqlParameter("@UserID",       SqlDbType.BigInt,      8),
                new SqlParameter("@Amount",       SqlDbType.Decimal,     9),
                new SqlParameter("@Price",        SqlDbType.Decimal,     9),
                new SqlParameter("@Number",       SqlDbType.Int,         4),
                new SqlParameter("@Quantity",     SqlDbType.Int,         4),
                new SqlParameter("@UnitNum",      SqlDbType.Int,         4),
                new SqlParameter("@SaleNum",      SqlDbType.Int,         4),
                new SqlParameter("@Charge",       SqlDbType.Decimal,     9),
                new SqlParameter("@PurchaseDate", SqlDbType.DateTime),
                new SqlParameter("@Remark",       SqlDbType.VarChar,   500),
                new SqlParameter("@IsPur",        SqlDbType.Int,         4),
                new SqlParameter("@IsUndo",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.Title;
            parameters[1].Value  = model.UserID;
            parameters[2].Value  = model.Amount;
            parameters[3].Value  = model.Price;
            parameters[4].Value  = model.Number;
            parameters[5].Value  = model.Quantity;
            parameters[6].Value  = model.UnitNum;
            parameters[7].Value  = model.SaleNum;
            parameters[8].Value  = model.Charge;
            parameters[9].Value  = model.PurchaseDate;
            parameters[10].Value = model.Remark;
            parameters[11].Value = model.IsPur;
            parameters[12].Value = model.IsUndo;

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

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt64(obj));
            }
        }
Exemple #3
0
        protected void lbtnExam_Click(object sender, EventArgs e)
        {
            if (iPurchaseID > 0)
            {
                lgk.Model.tb_Purchase purchaseInfo = purchaseBLL.GetModel(iPurchaseID);

                purchaseInfo.IsPur = 1;

                if (purchaseBLL.Update(purchaseInfo))
                {
                    ScriptManager.RegisterStartupScript(this.Page, typeof(Page), "info", "alert('审核成功!');window.location.href='CashExaminat.aspx';", true);
                }
            }
            else
            {
                MessageBox.MyShow(this, "审核失败!");
            }
        }
Exemple #4
0
        /// <summary>
        /// 显示数据
        /// </summary>
        private void ShowData()
        {
            lgk.Model.tb_Purchase purchaseInfo = purchaseBLL.GetModel(iPurchaseID);

            if (purchaseInfo != null)
            {
                #region 用户信息
                lgk.Model.tb_user userInfo = userBLL.GetModel(purchaseInfo.UserID);

                ltUserCode.Text = userInfo.UserCode;               //会员编号

                ltBankName.Text = userInfo.BankName;               //开户银行

                ltTrueName.Text = userInfo.TrueName;               //银行姓名

                ltBankAccount.Text = userInfo.BankAccount;         //银行帐号

                ltBankAccountUser.Text = userInfo.BankAccountUser; //银行姓名

                ltBankBranch.Text = userInfo.BankBranch;           //开户网点

                ltQQnumer.Text = userInfo.QQnumer;                 //卖家QQ号码

                ltPhoneNum.Text = userInfo.PhoneNum;               //卖家手机号码
                #endregion

                #region 求购信息
                ltTitle.Text     = purchaseInfo.Title;
                ltNumber.Text    = purchaseInfo.Number.ToString();
                ltQuantity.Text  = purchaseInfo.Quantity.ToString();
                ltPrice.Text     = purchaseInfo.Price.ToString("0.00");
                ltFactorage.Text = purchaseInfo.Charge.ToString("0.00");
                #endregion

                #region 信用等级
                lgk.Model.Cashcredit cashcreditInfo = cashcreditBLL.GetModel("UserID=" + purchaseInfo.UserID + "");
                if (cashcreditInfo != null)
                {
                    ltGrade.Text = cashcreditInfo.SValues.ToString();
                }
                #endregion
            }
        }
Exemple #5
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(lgk.Model.tb_Purchase model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_Purchase set ");
            strSql.Append(" Title = @Title,");
            strSql.Append(" UserID = @UserID,");
            strSql.Append(" Amount = @Amount,");
            strSql.Append(" Price = @Price,");
            strSql.Append(" Number = @Number,");
            strSql.Append(" Quantity = @Quantity,");
            strSql.Append(" UnitNum = @UnitNum,");
            strSql.Append(" SaleNum = @SaleNum,");
            strSql.Append(" Charge = @Charge,");
            strSql.Append(" PurchaseDate = @PurchaseDate,");
            strSql.Append(" Remark = @Remark,");
            strSql.Append(" IsPur = @IsPur,");
            strSql.Append(" IsUndo = @IsUndo");
            strSql.Append(" where PurchaseID=@PurchaseID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PurchaseID",   SqlDbType.BigInt,      8),
                new SqlParameter("@Title",        SqlDbType.VarChar,    60),
                new SqlParameter("@UserID",       SqlDbType.BigInt,      8),
                new SqlParameter("@Amount",       SqlDbType.Decimal,     9),
                new SqlParameter("@Price",        SqlDbType.Decimal,     9),
                new SqlParameter("@Number",       SqlDbType.Int,         4),
                new SqlParameter("@Quantity",     SqlDbType.Int,         4),
                new SqlParameter("@UnitNum",      SqlDbType.Int,         4),
                new SqlParameter("@SaleNum",      SqlDbType.Int,         4),
                new SqlParameter("@Charge",       SqlDbType.Decimal,     9),
                new SqlParameter("@PurchaseDate", SqlDbType.DateTime),
                new SqlParameter("@Remark",       SqlDbType.VarChar,   500),
                new SqlParameter("@IsPur",        SqlDbType.Int,         4),
                new SqlParameter("@IsUndo",       SqlDbType.Int, 4)
            };
            parameters[0].Value  = model.PurchaseID;
            parameters[1].Value  = model.Title;
            parameters[2].Value  = model.UserID;
            parameters[3].Value  = model.Amount;
            parameters[4].Value  = model.Price;
            parameters[5].Value  = model.Number;
            parameters[6].Value  = model.Quantity;
            parameters[7].Value  = model.UnitNum;
            parameters[8].Value  = model.SaleNum;
            parameters[9].Value  = model.Charge;
            parameters[10].Value = model.PurchaseDate;
            parameters[11].Value = model.Remark;
            parameters[12].Value = model.IsPur;
            parameters[13].Value = model.IsUndo;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.tb_Purchase GetModel(string strWhere)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select top 1 PurchaseID, Title, UserID, Amount, Price, Number, Quantity, UnitNum, SaleNum, Charge, PurchaseDate, Remark, IsPur, IsUndo");
            strSql.Append(" from tb_Purchase");
            if (strWhere.Trim() != "")
            {
                strSql.Append(" where " + strWhere);
            }

            lgk.Model.tb_Purchase model = new lgk.Model.tb_Purchase();
            DataSet ds = DbHelperSQL.Query(strSql.ToString());

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PurchaseID"].ToString() != "")
                {
                    model.PurchaseID = long.Parse(ds.Tables[0].Rows[0]["PurchaseID"].ToString());
                }
                model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                if (ds.Tables[0].Rows[0]["UserID"].ToString() != "")
                {
                    model.UserID = long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Amount"].ToString() != "")
                {
                    model.Amount = decimal.Parse(ds.Tables[0].Rows[0]["Amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Number"].ToString() != "")
                {
                    model.Number = int.Parse(ds.Tables[0].Rows[0]["Number"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Quantity"].ToString() != "")
                {
                    model.Quantity = int.Parse(ds.Tables[0].Rows[0]["Quantity"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UnitNum"].ToString() != "")
                {
                    model.UnitNum = int.Parse(ds.Tables[0].Rows[0]["UnitNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SaleNum"].ToString() != "")
                {
                    model.SaleNum = int.Parse(ds.Tables[0].Rows[0]["SaleNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Charge"].ToString() != "")
                {
                    model.Charge = decimal.Parse(ds.Tables[0].Rows[0]["Charge"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PurchaseDate"].ToString() != "")
                {
                    model.PurchaseDate = DateTime.Parse(ds.Tables[0].Rows[0]["PurchaseDate"].ToString());
                }
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                if (ds.Tables[0].Rows[0]["IsPur"].ToString() != "")
                {
                    model.IsPur = int.Parse(ds.Tables[0].Rows[0]["IsPur"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsUndo"].ToString() != "")
                {
                    model.IsUndo = int.Parse(ds.Tables[0].Rows[0]["IsUndo"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }
Exemple #7
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public lgk.Model.tb_Purchase GetModel(long PurchaseID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PurchaseID, Title, UserID, Amount, Price, Number, Quantity, UnitNum, SaleNum, Charge, PurchaseDate, Remark, IsPur, IsUndo");
            strSql.Append(" from tb_Purchase");
            strSql.Append(" where PurchaseID=@PurchaseID");
            SqlParameter[] parameters =
            {
                new SqlParameter("@PurchaseID", SqlDbType.BigInt, 8)
            };
            parameters[0].Value = PurchaseID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["PurchaseID"].ToString() != "")
                {
                    model.PurchaseID = long.Parse(ds.Tables[0].Rows[0]["PurchaseID"].ToString());
                }
                model.Title = ds.Tables[0].Rows[0]["Title"].ToString();
                if (ds.Tables[0].Rows[0]["UserID"].ToString() != "")
                {
                    model.UserID = long.Parse(ds.Tables[0].Rows[0]["UserID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Amount"].ToString() != "")
                {
                    model.Amount = decimal.Parse(ds.Tables[0].Rows[0]["Amount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Price"].ToString() != "")
                {
                    model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Number"].ToString() != "")
                {
                    model.Number = int.Parse(ds.Tables[0].Rows[0]["Number"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Quantity"].ToString() != "")
                {
                    model.Quantity = int.Parse(ds.Tables[0].Rows[0]["Quantity"].ToString());
                }
                if (ds.Tables[0].Rows[0]["UnitNum"].ToString() != "")
                {
                    model.UnitNum = int.Parse(ds.Tables[0].Rows[0]["UnitNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["SaleNum"].ToString() != "")
                {
                    model.SaleNum = int.Parse(ds.Tables[0].Rows[0]["SaleNum"].ToString());
                }
                if (ds.Tables[0].Rows[0]["Charge"].ToString() != "")
                {
                    model.Charge = decimal.Parse(ds.Tables[0].Rows[0]["Charge"].ToString());
                }
                if (ds.Tables[0].Rows[0]["PurchaseDate"].ToString() != "")
                {
                    model.PurchaseDate = DateTime.Parse(ds.Tables[0].Rows[0]["PurchaseDate"].ToString());
                }
                model.Remark = ds.Tables[0].Rows[0]["Remark"].ToString();
                if (ds.Tables[0].Rows[0]["IsPur"].ToString() != "")
                {
                    model.IsPur = int.Parse(ds.Tables[0].Rows[0]["IsPur"].ToString());
                }
                if (ds.Tables[0].Rows[0]["IsUndo"].ToString() != "")
                {
                    model.IsUndo = int.Parse(ds.Tables[0].Rows[0]["IsUndo"].ToString());
                }

                return(model);
            }
            else
            {
                return(null);
            }
        }