protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0, InsertRowDtls = 0; try { if (ChkDetails() == true) { DS = Obj_CM.ChkDuplicate(TxtCompanyName.Text.Trim(), out StrError); if (DS.Tables[0].Rows.Count > 0) { obj_Comm.ShowPopUpMsg("Record is Already Present..", this.Page); TxtCompanyName.Focus(); } else { Entity_CM.CompanyName = TxtCompanyName.Text; Entity_CM.abbreviation = Txtabbreviations.Text; Entity_CM.CAddress = TxtAddress.Text; Entity_CM.PhoneNo = TxtPhoneNo.Text.Trim(); Entity_CM.EmailId = TxtEmail.Text.Trim(); Entity_CM.Website = TxtWebsite.Text.Trim(); Entity_CM.FaxNo = TxtFaxNo.Text.Trim(); Entity_CM.TinNo = TxtTinNo.Text.Trim(); Entity_CM.VatNo = TxtVatNo.Text.Trim(); Entity_CM.ServiceTaxNo = TxtServiceTaxNo.Text.Trim(); Entity_CM.Note = TxtNoteC.Text.Trim(); Entity_CM.UserId = Convert.ToInt32(Session["UserId"]); Entity_CM.LoginDate = DateTime.Now; InsertRow = Obj_CM.InsertRecord(ref Entity_CM, out StrError); if (InsertRow > 0) { obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeEmptyForm(); Entity_CM = null; Obj_CM = null; } } } else { obj_Comm.ShowPopUpMsg("Please Enter Details ..!", this.Page); } } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void BtnSave_Click(object sender, EventArgs e) { int InsertRow = 0, InsertRowDtls = 0; try { if (ChkDetails() == true) { DS = Obj_CM.ChkDuplicate(TxtCompanyName.Text.Trim(), out StrError); if (DS.Tables[0].Rows.Count > 0) { obj_Comm.ShowPopUpMsg("Record is Already Present..", this.Page); TxtCompanyName.Focus(); } else { Entity_CM.CompanyName = TxtCompanyName.Text; Entity_CM.abbreviation = Txtabbreviations.Text; Entity_CM.CAddress = TxtAddress.Text; if (!string.IsNullOrEmpty(lblLogopath.Text)) { Entity_CM.CLogo = lblLogopath.Text; } else { Entity_CM.CLogo = ""; } Entity_CM.PhoneNo = TxtPhoneNo.Text.Trim(); Entity_CM.EmailId = TxtEmail.Text.Trim(); Entity_CM.Website = TxtWebsite.Text.Trim(); Entity_CM.FaxNo = TxtFaxNo.Text.Trim(); Entity_CM.TinNo = TxtTinNo.Text.Trim(); Entity_CM.VatNo = TxtVatNo.Text.Trim(); Entity_CM.ServiceTaxNo = TxtServiceTaxNo.Text.Trim(); if (!string.IsNullOrEmpty(LblSignPath.Text)) { Entity_CM.DigitalSignature = LblSignPath.Text; } else { Entity_CM.DigitalSignature = ""; } if (!string.IsNullOrEmpty(LblSignPath1.Text)) { Entity_CM.DigitalSignature1 = LblSignPath1.Text; } else { Entity_CM.DigitalSignature1 = ""; } if (!string.IsNullOrEmpty(LblSignPath2.Text)) { Entity_CM.DigitalSignature2 = LblSignPath2.Text; } else { Entity_CM.DigitalSignature2 = ""; } Entity_CM.Note = TxtNoteC.Text.Trim(); Entity_CM.UserId = Convert.ToInt32(Session["UserId"]); Entity_CM.LoginDate = DateTime.Now; InsertRow = Obj_CM.InsertRecord(ref Entity_CM, out StrError); if (InsertRow > 0) { if (ViewState["CurrentTable"] != null) { DataTable dtInsert = new DataTable(); dtInsert = (DataTable)ViewState["CurrentTable"]; for (int i = 0; i < dtInsert.Rows.Count; i++) { Entity_CM.CompanyId = InsertRow; Entity_CM.BankId = Convert.ToInt32(dtInsert.Rows[i]["BankId"].ToString()); Entity_CM.AccountNo = dtInsert.Rows[i]["AccountNo"].ToString(); Entity_CM.NoteB = dtInsert.Rows[i]["NoteB"].ToString(); InsertRowDtls = Obj_CM.InsertDetailsRecord(ref Entity_CM, out StrError); } } if (InsertRow > 0) { obj_Comm.ShowPopUpMsg("Record Saved Successfully", this.Page); MakeControlEmpty(); MakeEmptyForm(); Entity_CM = null; Obj_CM = null; } } } } else { obj_Comm.ShowPopUpMsg("Please Enter Details ..!", this.Page); } } catch (Exception ex) { throw new Exception(ex.Message); } }