Example #1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public int Add(TSM.Model.CK_SendGoods model)
        {
            StringBuilder strSql = new StringBuilder();

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

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

            if (obj == null)
            {
                return(1);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }
Example #2
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public void Update(TSM.Model.CK_SendGoods model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update CK_SendGoods set ");
            strSql.Append("CK_PeopleID=@CK_PeopleID,");
            strSql.Append("CK_ProductID=@CK_ProductID,");
            strSql.Append("CK_SendGoodsNo=@CK_SendGoodsNo,");
            strSql.Append("CK_SendGoodsAmount=@CK_SendGoodsAmount,");
            strSql.Append("CK_SendGoodsDate=@CK_SendGoodsDate");
            strSql.Append(" where CK_SendGoodsID=@CK_SendGoodsID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CK_SendGoodsID",     SqlDbType.Int,      4),
                new SqlParameter("@CK_PeopleID",        SqlDbType.Int,      4),
                new SqlParameter("@CK_ProductID",       SqlDbType.Int,      4),
                new SqlParameter("@CK_SendGoodsNo",     SqlDbType.VarChar, 32),
                new SqlParameter("@CK_SendGoodsAmount", SqlDbType.Int,      4),
                new SqlParameter("@CK_SendGoodsDate",   SqlDbType.DateTime)
            };
            parameters[0].Value = model.CK_SendGoodsID;
            parameters[1].Value = model.CK_PeopleID;
            parameters[2].Value = model.CK_ProductID;
            parameters[3].Value = model.CK_SendGoodsNo;
            parameters[4].Value = model.CK_SendGoodsAmount;
            parameters[5].Value = model.CK_SendGoodsDate;

            DbHelperSQL.ExecuteSql(strSql.ToString(), parameters);
        }
Example #3
0
 private void SaveSendGoods()
 {
     TSM.Model.CK_SendGoods modelCK_SendGoods = new TSM.Model.CK_SendGoods();
     modelCK_SendGoods.CK_ProductID       = int.Parse(DropDownListProduct.SelectedValue);
     modelCK_SendGoods.CK_PeopleID        = int.Parse(DropDownListPeople.SelectedValue);
     modelCK_SendGoods.CK_SendGoodsAmount = int.Parse(tbxCount.Text.Trim());
     modelCK_SendGoods.CK_SendGoodsDate   = (DateTime)DatePicker1.SelectedDate;
     modelCK_SendGoods.CK_SendGoodsNo     = GetTGNumber();
     m_bllCK_SendGoods.Add(modelCK_SendGoods);
 }
 private void SaveSendGoods()
 {
     TSM.Model.CK_SendGoods modelCK_SendGoods = new TSM.Model.CK_SendGoods();
     modelCK_SendGoods.CK_ProductID = int.Parse(DropDownListProduct.SelectedValue);
     modelCK_SendGoods.CK_PeopleID = int.Parse(DropDownListPeople.SelectedValue);
     modelCK_SendGoods.CK_SendGoodsAmount = int.Parse(tbxCount.Text.Trim());
     modelCK_SendGoods.CK_SendGoodsDate = (DateTime)DatePicker1.SelectedDate;
     modelCK_SendGoods.CK_SendGoodsNo = GetTGNumber();
     m_bllCK_SendGoods.Add(modelCK_SendGoods);
 }
        protected void btnSaveClose_Click(object sender, EventArgs e)
        {
            int id = GetQueryIntValue("id");

            TSM.Model.CK_SendGoods modelCK_SendGoods = m_bllCK_SendGoods.GetModel(id);
            modelCK_SendGoods.CK_ProductID       = int.Parse(DropDownListProduct.SelectedValue);
            modelCK_SendGoods.CK_PeopleID        = int.Parse(DropDownListPeople.SelectedValue);
            modelCK_SendGoods.CK_SendGoodsAmount = int.Parse(tbxCount.Text.Trim());
            modelCK_SendGoods.CK_SendGoodsDate   = (DateTime)DatePicker1.SelectedDate;


            m_bllCK_SendGoods.Update(modelCK_SendGoods);

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

            strSql.Append("select  top 1 CK_SendGoodsID,CK_PeopleID,CK_ProductID,CK_SendGoodsNo,CK_SendGoodsAmount,CK_SendGoodsDate from CK_SendGoods ");
            strSql.Append(" where CK_SendGoodsID=@CK_SendGoodsID ");
            SqlParameter[] parameters =
            {
                new SqlParameter("@CK_SendGoodsID", SqlDbType.Int, 4)
            };
            parameters[0].Value = CK_SendGoodsID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["CK_SendGoodsID"].ToString() != "")
                {
                    model.CK_SendGoodsID = int.Parse(ds.Tables[0].Rows[0]["CK_SendGoodsID"].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_SendGoodsNo = ds.Tables[0].Rows[0]["CK_SendGoodsNo"].ToString();
                if (ds.Tables[0].Rows[0]["CK_SendGoodsAmount"].ToString() != "")
                {
                    model.CK_SendGoodsAmount = int.Parse(ds.Tables[0].Rows[0]["CK_SendGoodsAmount"].ToString());
                }
                if (ds.Tables[0].Rows[0]["CK_SendGoodsDate"].ToString() != "")
                {
                    model.CK_SendGoodsDate = DateTime.Parse(ds.Tables[0].Rows[0]["CK_SendGoodsDate"].ToString());
                }
                return(model);
            }
            else
            {
                return(null);
            }
        }
        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_SendGoods modelCK_SendGoods = m_bllCK_SendGoods.GetModel(id);

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

            TSM.Model.CK_SendGoods model=new TSM.Model.CK_SendGoods();
            DataSet ds=DbHelperSQL.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["CK_SendGoodsID"].ToString()!="")
                {
                    model.CK_SendGoodsID=int.Parse(ds.Tables[0].Rows[0]["CK_SendGoodsID"].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_SendGoodsNo=ds.Tables[0].Rows[0]["CK_SendGoodsNo"].ToString();
                if(ds.Tables[0].Rows[0]["CK_SendGoodsAmount"].ToString()!="")
                {
                    model.CK_SendGoodsAmount=int.Parse(ds.Tables[0].Rows[0]["CK_SendGoodsAmount"].ToString());
                }
                if(ds.Tables[0].Rows[0]["CK_SendGoodsDate"].ToString()!="")
                {
                    model.CK_SendGoodsDate=DateTime.Parse(ds.Tables[0].Rows[0]["CK_SendGoodsDate"].ToString());
                }
                return model;
            }
            else
            {
                return null;
            }
        }