Exemplo n.º 1
0
        public static bool UpdateRowIndex(String str)
        {
            try
            {
                //Thread.Sleep(4000);

                LossListDAO dao = new LossListDAO();
                IDictionary<int, int> myDic = new Dictionary<int, int>();

                String[] strData = str.Split(',');
                for (int i = 0; i < strData.Length; i++)
                {
                    String[] strObj = strData[i].Split(':');
                    myDic.Add(int.Parse(strObj[0].Trim()), int.Parse(strObj[1].Trim()));
                }

                dao.UpdateRowIndex(myDic);

                return true;
            }
            catch (Exception ex)
            {
                return false;
            }
        }
 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>");
     }
 }