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>"); } } }
protected void gvgvLoaiHangMucDetails_OnRowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { Label lblLoaiHangMucID = (Label)e.Row.FindControl("lblLoaiHangMucID"); Label lblSTT = (Label)e.Row.FindControl("lblSTT"); lblSTT.Text = SAVVYUtil.getRoman(e.Row.RowIndex + 1); string strLoaiHangMucID = lblLoaiHangMucID.Text; DataTable dt = LossListDAO.SelectClaimDetail(mClaimID, int.Parse(strLoaiHangMucID)); Repeater RepeaterChild = (Repeater)e.Row.FindControl("repeaterChild"); RepeaterChild.DataSource = dt; RepeaterChild.DataBind(); } }