Esempio n. 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TSM.Model.CK_TakeGoods model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CK_TakeGoods set ");
            strSql.Append("CK_PeopleID=@CK_PeopleID,");
            strSql.Append("CK_ProductID=@CK_ProductID,");
            strSql.Append("CK_TakeGoodsNo=@CK_TakeGoodsNo,");
            strSql.Append("CK_TakeGoodsAmount=@CK_TakeGoodsAmount,");
            strSql.Append("CK_TakeGoodsDate=@CK_TakeGoodsDate");
            strSql.Append(" where CK_TakeGoodsID=@CK_TakeGoodsID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CK_TakeGoodsID",     SqlDbType.Int,      4),
                new SqlParameter("@CK_PeopleID",        SqlDbType.Int,      4),
                new SqlParameter("@CK_ProductID",       SqlDbType.Int,      4),
                new SqlParameter("@CK_TakeGoodsNo",     SqlDbType.VarChar, 32),
                new SqlParameter("@CK_TakeGoodsAmount", SqlDbType.Int,      4),
                new SqlParameter("@CK_TakeGoodsDate",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.CK_TakeGoodsID;
            parameters[1].Value = model.CK_PeopleID;
            parameters[2].Value = model.CK_ProductID;
            parameters[3].Value = model.CK_TakeGoodsNo;
            parameters[4].Value = model.CK_TakeGoodsAmount;
            parameters[5].Value = model.CK_TakeGoodsDate;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Esempio n. 2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TSM.Model.CK_TakeGoods model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into CK_TakeGoods(");
            strSql.Append("CK_PeopleID,CK_ProductID,CK_TakeGoodsNo,CK_TakeGoodsAmount,CK_TakeGoodsDate)");
            strSql.Append(" values (");
            strSql.Append("@CK_PeopleID,@CK_ProductID,@CK_TakeGoodsNo,@CK_TakeGoodsAmount,@CK_TakeGoodsDate)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CK_PeopleID",        SqlDbType.Int,      4),
                new SqlParameter("@CK_ProductID",       SqlDbType.Int,      4),
                new SqlParameter("@CK_TakeGoodsNo",     SqlDbType.VarChar, 32),
                new SqlParameter("@CK_TakeGoodsAmount", SqlDbType.Int,      4),
                new SqlParameter("@CK_TakeGoodsDate",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.CK_PeopleID;
            parameters[1].Value = model.CK_ProductID;
            parameters[2].Value = model.CK_TakeGoodsNo;
            parameters[3].Value = model.CK_TakeGoodsAmount;
            parameters[4].Value = model.CK_TakeGoodsDate;

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
 private void SaveTakeGoods()
 {
     TSM.Model.CK_TakeGoods modelCK_TakeGoods = new TSM.Model.CK_TakeGoods();
     modelCK_TakeGoods.CK_ProductID = int.Parse(DropDownListProduct.SelectedValue);
     modelCK_TakeGoods.CK_PeopleID = int.Parse(DropDownListPeople.SelectedValue);
     modelCK_TakeGoods.CK_TakeGoodsAmount = int.Parse(tbxCount.Text.Trim());
     modelCK_TakeGoods.CK_TakeGoodsDate = (DateTime)DatePicker1.SelectedDate;
     modelCK_TakeGoods.CK_TakeGoodsNo = GetTGNumber();
     m_bllCK_TakeGoods.Add(modelCK_TakeGoods);
 }
Esempio n. 4
0
 private void SaveTakeGoods()
 {
     TSM.Model.CK_TakeGoods modelCK_TakeGoods = new TSM.Model.CK_TakeGoods();
     modelCK_TakeGoods.CK_ProductID       = int.Parse(DropDownListProduct.SelectedValue);
     modelCK_TakeGoods.CK_PeopleID        = int.Parse(DropDownListPeople.SelectedValue);
     modelCK_TakeGoods.CK_TakeGoodsAmount = int.Parse(tbxCount.Text.Trim());
     modelCK_TakeGoods.CK_TakeGoodsDate   = (DateTime)DatePicker1.SelectedDate;
     modelCK_TakeGoods.CK_TakeGoodsNo     = GetTGNumber();
     m_bllCK_TakeGoods.Add(modelCK_TakeGoods);
 }
Esempio n. 5
0
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            int id = GetQueryIntValue("id");

            TSM.Model.CK_TakeGoods modelCK_TakeGoods = m_bllCK_TakeGoods.GetModel(id);
            modelCK_TakeGoods.CK_ProductID       = int.Parse(DropDownListProduct.SelectedValue);
            modelCK_TakeGoods.CK_PeopleID        = int.Parse(DropDownListPeople.SelectedValue);
            modelCK_TakeGoods.CK_TakeGoodsAmount = int.Parse(tbxCount.Text.Trim());
            modelCK_TakeGoods.CK_TakeGoodsDate   = (DateTime)DatePicker1.SelectedDate;


            m_bllCK_TakeGoods.Update(modelCK_TakeGoods);

            //FineUI.Alert.Show("保存成功!", String.Empty, FineUI.Alert.DefaultIcon, FineUI.ActiveWindow.GetHidePostBackReference());
            PageContext.RegisterStartupScript(ActiveWindow.GetHidePostBackReference());
        }
Esempio n. 6
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TSM.Model.CK_TakeGoods GetModel(int CK_TakeGoodsID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select  top 1 CK_TakeGoodsID,CK_PeopleID,CK_ProductID,CK_TakeGoodsNo,CK_TakeGoodsAmount,CK_TakeGoodsDate from CK_TakeGoods ");
            strSql.Append(" where CK_TakeGoodsID=@CK_TakeGoodsID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CK_TakeGoodsID", SqlDbType.Int, 4)
            };
            parameters[0].Value = CK_TakeGoodsID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["CK_TakeGoodsID"].ToString() != "")
                {
                    model.CK_TakeGoodsID = int.Parse(ds.Tables[0].Rows[0]["CK_TakeGoodsID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CK_PeopleID"].ToString() != "")
                {
                    model.CK_PeopleID = int.Parse(ds.Tables[0].Rows[0]["CK_PeopleID"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CK_ProductID"].ToString() != "")
                {
                    model.CK_ProductID = int.Parse(ds.Tables[0].Rows[0]["CK_ProductID"].ToString());
                }
                model.CK_TakeGoodsNo = ds.Tables[0].Rows[0]["CK_TakeGoodsNo"].ToString();
                if (ds.Tables[0].Rows[0]["CK_TakeGoodsAmount"].ToString() != "")
                {
                    model.CK_TakeGoodsAmount = int.Parse(ds.Tables[0].Rows[0]["CK_TakeGoodsAmount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CK_TakeGoodsDate"].ToString() != "")
                {
                    model.CK_TakeGoodsDate = DateTime.Parse(ds.Tables[0].Rows[0]["CK_TakeGoodsDate"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 7
0
        private void LoadData()
        {
            btnClose.OnClientClick = ActiveWindow.GetHideReference();


            DataSet ds = m_bllCK_People.GetList("");

            DropDownListPeople.DataTextField  = "CK_PeopleName";
            DropDownListPeople.DataValueField = "CK_PeopleID";
            DropDownListPeople.DataSource     = ds.Tables[0];
            DropDownListPeople.DataBind();
            DropDownListPeople.SelectedIndex = 0;

            ds = m_bllCK_Product.GetList("");
            DropDownListProduct.DataTextField  = "CK_ProductName";
            DropDownListProduct.DataValueField = "CK_ProductID";
            DropDownListProduct.DataSource     = ds.Tables[0];
            DropDownListProduct.DataBind();
            DropDownListProduct.SelectedIndex = 0;

            int id = GetQueryIntValue("id");

            TSM.Model.CK_TakeGoods modelCK_TakeGoods = m_bllCK_TakeGoods.GetModel(id);

            if (modelCK_TakeGoods == null)
            {
                // 参数错误,首先弹出Alert对话框然后关闭弹出窗口
                Alert.Show("参数错误!", String.Empty, ActiveWindow.GetHideReference());
                return;
            }
            DropDownListProduct.SelectedValue = modelCK_TakeGoods.CK_ProductID.ToString();
            DropDownListPeople.SelectedValue  = modelCK_TakeGoods.CK_PeopleID.ToString();
            tbxCount.Text            = modelCK_TakeGoods.CK_TakeGoodsAmount.ToString();
            DatePicker1.SelectedDate = modelCK_TakeGoods.CK_TakeGoodsDate;
            //tbxName.Text = modelCK_TakeGoods.CK_TakeGoodsName;
            //tbxPhoneNo.Text = modelCK_TakeGoods.CK_PhoneNo;
            //tbxNote.Text = modelCK_TakeGoods.CK_Comment;
        }
Esempio n. 8
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public TSM.Model.CK_TakeGoods GetModel(int CK_TakeGoodsID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select  top 1 CK_TakeGoodsID,CK_PeopleID,CK_ProductID,CK_TakeGoodsNo,CK_TakeGoodsAmount,CK_TakeGoodsDate from CK_TakeGoods ");
            strSql.Append(" where CK_TakeGoodsID=@CK_TakeGoodsID ");
            SqlParameter[] parameters = {
                    new SqlParameter("@CK_TakeGoodsID", SqlDbType.Int,4)};
            parameters[0].Value = CK_TakeGoodsID;

            TSM.Model.CK_TakeGoods model=new TSM.Model.CK_TakeGoods();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["CK_TakeGoodsID"].ToString()!="")
                {
                    model.CK_TakeGoodsID=int.Parse(ds.Tables[0].Rows[0]["CK_TakeGoodsID"].ToString());
                }
                if(ds.Tables[0].Rows[0]["CK_PeopleID"].ToString()!="")
                {
                    model.CK_PeopleID=int.Parse(ds.Tables[0].Rows[0]["CK_PeopleID"].ToString());
                }
                if(ds.Tables[0].Rows[0]["CK_ProductID"].ToString()!="")
                {
                    model.CK_ProductID=int.Parse(ds.Tables[0].Rows[0]["CK_ProductID"].ToString());
                }
                model.CK_TakeGoodsNo=ds.Tables[0].Rows[0]["CK_TakeGoodsNo"].ToString();
                if(ds.Tables[0].Rows[0]["CK_TakeGoodsAmount"].ToString()!="")
                {
                    model.CK_TakeGoodsAmount=int.Parse(ds.Tables[0].Rows[0]["CK_TakeGoodsAmount"].ToString());
                }
                if(ds.Tables[0].Rows[0]["CK_TakeGoodsDate"].ToString()!="")
                {
                    model.CK_TakeGoodsDate=DateTime.Parse(ds.Tables[0].Rows[0]["CK_TakeGoodsDate"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }