Esempio n. 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string[]     s              = ((Button)sender).CommandArgument.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries);
            int          i              = int.Parse(s[0]);
            int          idcasau        = int.Parse(s[1]);
            GridViewRow  r              = grvDanhSach.Rows[i];
            TextBox      txtDa_Bung     = (TextBox)r.FindControl("txtDa_Bung");
            DropDownList ddlDa_PhanLoai = (DropDownList)r.FindControl("ddlDa_PhanLoai");
            DropDownList ddlPPM         = (DropDownList)r.FindControl("ddlPPM");
            DropDownList ddlLyDoChet    = (DropDownList)(r.FindControl("ddlLyDoChet"));
            TextBox      txtKhoiLuong   = (TextBox)(r.FindControl("txtKhoiLuong"));
            TextBox      txtBienBan     = (TextBox)(r.FindControl("txtBienBan"));

            if (txtKhoiLuong.Text == "")
            {
                txtKhoiLuong.Text = "0";
            }
            CheckBox    chkDau  = (CheckBox)r.FindControl("chkDau");
            PlaceHolder dsVatTu = (PlaceHolder)r.FindControl("dsVatTu");
            string      sVatTu  = CreateSVatTu(dsVatTu);
            int         res     = csCont.CaChet_UpdateThongSo(idcasau, int.Parse(txtDa_Bung.Text), int.Parse(ddlDa_PhanLoai.SelectedValue), Convert.ToInt32(chkDau.Checked), ddlPPM.SelectedValue, int.Parse(ddlLyDoChet.SelectedValue), decimal.Parse(txtKhoiLuong.Text.Trim()), txtBienBan.Text, UserId, sVatTu);

            if (res == 1)
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "savesuccess", "alert('Lưu thành công');", true);
            }
            else
            {
                Page.ClientScript.RegisterStartupScript(typeof(string), "savefail", "alert('Lưu không thành công');", true);
            }
        }