예제 #1
0
    protected void gvwRecords_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        DropDownList ddl = gvwRecords.Rows[e.RowIndex].FindControl("ddlGoods") as DropDownList;
        TextBox      txt = gvwRecords.Rows[e.RowIndex].FindControl("txtAmount") as TextBox;

        EOfficeGoodsRecords eogr = new EOfficeGoodsRecords
        {
            SupplyId = Convert.ToInt32(e.Keys[0]),
            GoodID   = ddl.SelectedValue,
            Amount   = Convert.ToInt32(txt.Text)
        };

        try
        {
            if (OfficeGoodsRecordsMgr.UpdateOfficeGoodsRecords(eogr))
            {
                ClientScript.RegisterStartupScript(GetType(), "msg", "alert('修改成功!!!');", true);
                gvwRecords.EditIndex = -1;
                btnSearch_Click(null, null);
            }
        }
        catch
        {
            ClientScript.RegisterStartupScript(GetType(), "msg", "alert('修改异常!!!');", true);
        }
    }
예제 #2
0
    protected void btnInsert_Click(object sender, EventArgs e)
    {
        EOfficeGoodsRecords eogr = new EOfficeGoodsRecords
        {
            EmpID  = txtEmpID.Text,
            GoodID = ddlOfficeGoodsInfo.SelectedValue,
            Amount = Convert.ToInt32(txtAmount.Text),
            Remark = txtRemark.Text
        };

        try
        {
            if (OfficeGoodsRecordsMgr.InsertOfficeGoodsRecords(eogr))
            {
                ClientScript.RegisterStartupScript(GetType(), "msg", "alert('添加成功!!!');", true);
                //清空
                txtEmpID.Text = txtAmount.Text = txtRemark.Text = "";
                ddlOfficeGoodsInfo.SelectedIndex = 0;       //选中第一项
            }
        }
        catch
        {
            ClientScript.RegisterStartupScript(GetType(), "msg", "alert('添加异常!!!!!!');", true);
        }
    }
예제 #3
0
        //查询私有公共方法:所有字段
        private List <EOfficeGoodsRecords> CommQueryOfficeGoodsRecordss(string sql)
        {
            List <EOfficeGoodsRecords> elist = new List <EOfficeGoodsRecords>();
            SqlDataReader dr = DBHelper.GetReader(sql);

            while (dr.Read())
            {
                EOfficeGoodsRecords entity = new EOfficeGoodsRecords();
                entity.SupplyId   = Convert.ToInt32(dr["SupplyId"]);
                entity.EmpID      = Convert.ToString(dr["EmpID"]);
                entity.SupplyTime = Convert.ToDateTime(dr["SupplyTime"]);
                entity.GoodID     = Convert.ToString(dr["GoodID"]);
                entity.Amount     = Convert.ToInt32(dr["Amount"]);
                entity.Remark     = Convert.ToString(dr["Remark"]);

                entity.GoodName = Convert.ToString(dr["GoodName"]);
                elist.Add(entity);
            }
            return(elist);
        }
예제 #4
0
        //根据主键更新数据
        public bool UpdateOfficeGoodsRecords(EOfficeGoodsRecords entity)
        {
            string sql = string.Format("UPDATE OfficeGoodsRecords SET GoodID='{1}',Amount='{2}' WHERE SupplyId='{0}'", entity.SupplyId, entity.GoodID, entity.Amount);

            return(DBHelper.UpdateOpera(sql));
        }
예제 #5
0
        //插入所有数据
        public bool InsertOfficeGoodsRecords(EOfficeGoodsRecords entity)
        {
            string sql = string.Format("INSERT INTO OfficeGoodsRecords(EmpID,SupplyTime,GoodID,Amount,Remark) VALUES('{0}',getDate(),'{1}','{2}','{3}')", entity.EmpID, entity.GoodID, entity.Amount, entity.Remark);

            return(DBHelper.UpdateOpera(sql));
        }
예제 #6
0
 //根据主键更新数据
 public static bool UpdateOfficeGoodsRecords(EOfficeGoodsRecords entity)
 {
     return(svr.UpdateOfficeGoodsRecords(entity));
 }
예제 #7
0
 //插入所有字段
 public static bool InsertOfficeGoodsRecords(EOfficeGoodsRecords entity)
 {
     return(svr.InsertOfficeGoodsRecords(entity));
 }