Ejemplo n.º 1
0
        protected void grDSItem_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            GridViewRow row            = grDSItem.Rows[e.RowIndex];
            TextBox     txtTenHangMuc2 = row.Cells[1].Controls[0] as TextBox;
            TextBox     txtsoluong2    = row.Cells[2].Controls[0] as TextBox;
            TextBox     txtghichu2     = row.Cells[5].Controls[0] as TextBox;
            int         ma             = int.Parse(grDSItem.DataKeys[e.RowIndex].Value.ToString());
            LossListDTO l = new LossListDTO();

            l.MaLossList = ma;
            l.TenHangMuc = txtTenHangMuc2.Text;
            l.SoLuong    = float.Parse(txtsoluong2.Text);
            l.GhiChu     = txtghichu2.Text;
            bool kq = ld.Update(l);

            if (kq == true)
            {
                e.Cancel           = true;
                grDSItem.EditIndex = -1;
                LoadItem(lblIDClaim.Text);
                int    maGDV   = int.Parse(Request.Cookies["MaGDV"].Value);
                string noidung = gdv.LayTenTheoMa(maGDV) + " edited item of list worksheet of case " + lblIDClaim.Text + ".";
                SaveLogTracking(maGDV, noidung, lblIDClaim.Text);
            }
        }
Ejemplo n.º 2
0
        public bool Update(LossListDTO l)
        {
            string sql             = "sp_LostList_Update";
            List <SqlParameter> ds = new List <SqlParameter>();

            SqlParameter diengiai = new SqlParameter("@diengiai", SqlDbType.NVarChar);

            diengiai.Value = l.TenHangMuc;
            ds.Add(diengiai);

            SqlParameter soluong = new SqlParameter("@soluong", SqlDbType.Float);

            soluong.Value = l.SoLuong;
            ds.Add(soluong);



            SqlParameter ghichu = new SqlParameter("@ghichu", SqlDbType.NVarChar);

            ghichu.Value = l.GhiChu;
            ds.Add(ghichu);

            SqlParameter id = new SqlParameter("@malostlist", SqlDbType.Int);

            id.Value = l.MaLossList;
            ds.Add(id);
            bool kq = false;

            kq = SqlDataAcessHelper.exNonStoreParas(sql, ds);
            return(kq);
        }
 protected void btnInsertItem_Click(object sender, EventArgs e)
 {
     if (this.IsPostBack)
     {
         LossListDTO l          = new LossListDTO();
         LossListDAO ldao       = new LossListDAO();
         string      tenhangmuc = txtDescription.Text;
         if (tenhangmuc != "")
         {
             l.TenHangMuc = tenhangmuc;
             float sl = 0;
             if (txtSoLuong.Text != "" && float.TryParse(txtSoLuong.Text, out sl))
             {
                 l.SoLuong     = sl;
                 l.MaDonViTinh = int.Parse(drUnit.SelectedItem.Value.ToString());
                 string ghichu = txtGhiChu.Text;
                 if (ghichu != "")
                 {
                     l.GhiChu = ghichu;
                 }
                 else
                 {
                     l.GhiChu = "";
                 }
                 l.LoaiHangMuc = int.Parse(drTypeItem.SelectedItem.Value.ToString());
                 l.MaClaim     = lblIDClaim.Text;
                 bool kq = ldao.Insert(l);
                 if (kq == true)
                 {
                     int    maGDV   = int.Parse(Request.Cookies["MaGDV"].Value);
                     string noidung = gdv.LayTenTheoMa(maGDV) + " created item loss worksheet of case " + lblIDClaim.Text + ".";
                     SaveLogTracking(maGDV, noidung, lblIDClaim.Text);
                     LoadItem(lblIDClaim.Text);
                     ClearInputs(Page.Controls);
                 }
                 else
                 {
                     Response.Write("<script>alert('Nhập đủ các vị trí có (*)!');</script>");
                 }
             }
             else
             {
                 Response.Write("<script>alert('Nhập sai định dạng sô!');</script>");
             }
         }
         else
         {
             Response.Write("<script>alert('Không bỏ trống tên hạng mục tổn thất!');</script>");
         }
     }
 }
Ejemplo n.º 4
0
        public bool Insert(LossListDTO l)
        {
            string sql             = "sp_LostList_Insert";
            List <SqlParameter> ds = new List <SqlParameter>();

            SqlParameter diengiai = new SqlParameter("@diengiai", SqlDbType.NVarChar);

            diengiai.Value = l.TenHangMuc;
            ds.Add(diengiai);

            SqlParameter soluong = new SqlParameter("@soluong", SqlDbType.Float);

            soluong.Value = l.SoLuong;
            ds.Add(soluong);

            SqlParameter donvi = new SqlParameter("@donvi", SqlDbType.Int);

            donvi.Value = l.MaDonViTinh;
            ds.Add(donvi);

            SqlParameter ghichu = new SqlParameter("@ghichu", SqlDbType.NVarChar);

            ghichu.Value = l.GhiChu;
            ds.Add(ghichu);

            SqlParameter loai = new SqlParameter("@loai", SqlDbType.Int);

            loai.Value = l.LoaiHangMuc;
            ds.Add(loai);

            SqlParameter idclaim = new SqlParameter("@idclaim", SqlDbType.VarChar);

            idclaim.Value = l.MaClaim;
            ds.Add(idclaim);
            bool kq = false;

            kq = SqlDataAcessHelper.exNonStoreParas(sql, ds);
            return(kq);
        }