private void dgTax_DoubleClick(object sender, EventArgs e) { try { int gridCount = dgTax.Rows.Count; if (gridCount > 1) { clearForm(); taxCode = dgTax.Rows[dgTax.Row][1].ToString(); doc = dgTax.Rows[dgTax.Row][2].ToString(); taxName = dgTax.Rows[dgTax.Row][3].ToString(); if (taxCode != "Tax Code") { TaxModel taxdata = new TaxModel(); TaxSiteDocMapModel taxsitedocmap = new TaxSiteDocMapModel(); taxdata = this.taxManager.GetTaxByID(taxCode); taxsitedocmap = this.taxManager.GetTaxByDoc(taxCode, doc); if (taxdata != null) { txtTaxName.Text = taxdata.TaxName; txtTaxValue.Value = taxdata.Value; cmbDocumentType.SelectedValue = taxsitedocmap.DocumentType; cmbAppliedon.SelectedValue = taxsitedocmap.Appliedon; if (taxdata.Type == "Per") { rdoTVTPercent.Checked = true; } else { rdoTVTValue.Checked = true; } if (taxdata.Inclusive == true) { rdoTaxInclusive.Checked = true; } else { rdoTaxExclusive.Checked = true; } if (taxdata.InterStateTax == true) { chkInterStateTax.Checked = true; } else { chkInterStateTax.Checked = false; } flag = true; } } } } catch (Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } }
public bool UpdateTax(TaxModel taxModel, TaxSiteDocMapModel taxsitedocMapModel) { taxModel.ToAddOrModifyEntity(true); var tax = Mapper.Map(taxModel, new MstTax()); taxsitedocMapModel.ToAddOrModifyEntity(true); var taxsitedocMap = Mapper.Map(taxsitedocMapModel, new TaxSiteDocMap()); return(this.taxRepository.UpdateTax(tax, taxsitedocMap)); }
private void btnSave_Click(object sender, System.EventArgs e) { try { if (ValidateTax()) { TaxModel taxdata = new TaxModel(); TaxSiteMappingModel taxSiteMap = new TaxSiteMappingModel(); TaxSiteDocMapModel taxsitedoc = new TaxSiteDocMapModel(); taxdata.TaxName = txtTaxName.Text; if (rdoTaxInclusive.Checked == true) { taxdata.Inclusive = true; taxsitedoc.Inclusive = true; } else { taxdata.Inclusive = false; taxsitedoc.Inclusive = false; } if (rdoTVTPercent.Checked == true) { taxdata.Type = "Per"; taxsitedoc.IsPercentageValue = true; } else { taxdata.Type = "Val"; taxsitedoc.IsPercentageValue = false; } if (chkInterStateTax.Checked == true) { taxdata.InterStateTax = true; } else { taxdata.InterStateTax = false; } taxdata.TaxSeqProfile = "A"; taxdata.Value = Convert.ToDecimal(txtTaxValue.Text); taxsitedoc.TaxValue = Convert.ToDecimal(txtTaxValue.Text); taxdata.UpdatedAt = CommonModel.SiteCode; taxdata.UpdatedBy = CommonModel.UserID; bool Status = false; if (flag == true && taxCode != "") { Dupdoc = cmbDocumentType.SelectedValue.ToString(); // taxName = txtTaxName.Text; bool Duplicate = false; taxdata.TaxCode = taxCode; taxsitedoc.TaxCode = taxCode; taxsitedoc.DocumentType = cmbDocumentType.SelectedValue.ToString(); taxsitedoc.UpdatedAt = CommonModel.SiteCode; taxsitedoc.UpdatedBy = CommonModel.UserID; taxsitedoc.TaxName = txtTaxName.Text; taxsitedoc.SiteCode = CommonModel.SiteCode; taxsitedoc.IsDocumentLevelTax = false; taxsitedoc.Appliedon = cmbAppliedon.SelectedValue.ToString(); Duplicate = this.taxManager.DuplicateRecords(taxName, Dupdoc, taxCode); //if (taxsitedoc.DocumentType != doc) //{ // Status = this.taxManager.UpdateTax(taxdata, taxsitedoc); // if (Status == true) // CommonFunc.ShowMessage("Tax " + taxCode + " Updated Successfully.", MessageType.Information); // else // CommonFunc.ShowMessage("Error!!!", MessageType.Information); //} if (Duplicate == false) { Status = this.taxManager.UpdateTax(taxdata, taxsitedoc); CommonFunc.ShowMessage("Tax " + taxCode + " Updated Successfully.", MessageType.Information); } else { Status = this.taxManager.UpdateTaxDoc(taxdata, taxsitedoc); CommonFunc.ShowMessage("Tax " + taxCode + " Updated Successfully.", MessageType.Information); } } else { string newtaxcode = GetTaxCode("C"); taxdata.TaxCode = newtaxcode; taxSiteMap.Taxcode = newtaxcode; taxSiteMap.Sitecode = CommonModel.SiteCode; taxSiteMap.Defaultsite = false; taxsitedoc.TaxCode = newtaxcode; taxsitedoc.SiteCode = CommonModel.SiteCode; taxsitedoc.DocumentType = cmbDocumentType.SelectedValue.ToString(); taxsitedoc.Appliedon = cmbAppliedon.SelectedValue.ToString(); taxsitedoc.TaxName = txtTaxName.Text; taxsitedoc.IsDocumentLevelTax = false; Status = this.taxManager.SaveTax(taxdata, taxSiteMap, taxsitedoc); if (Status == true) { this.commonManager.UpdateNextID(CommonModel.SiteCode, "TX"); CommonFunc.ShowMessage("Tax " + newtaxcode + " Added Successfully.", MessageType.Information); } else { CommonFunc.ShowMessage("Error!!!", MessageType.Information); } } Fillgrid(); clearForm(); } } catch (System.Exception ex) { CommonFunc.ShowMessage(ex.Message, MessageType.Information); Logger.Log(ex.Message, Logger.LogingLevel.Error); } finally { } }