//protected void chkActive_CheckedChanged(object sender, EventArgs e) //{ // try // { // GridViewRow row = (sender as CheckBox).Parent.Parent as GridViewRow; // CheckBox chkactive = (CheckBox)row.FindControl("chkActive"); // if (chkactive.Checked == true) // { // lclsservice.DeleteItem(Convert.ToInt64(row.Cells[2].Text), true, Convert.ToInt64(defaultPage.UserId)); // } // else // { // lclsservice.DeleteItem(Convert.ToInt64(row.Cells[2].Text), false, Convert.ToInt64(defaultPage.UserId)); // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesDeleteMessage.Replace("<<Itemname>>", row.Cells[4].Text.ToString()), true); // } // BindItem(); // } // catch (Exception ex) // { // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesErrorMessage.Replace("<<Itemname>>", ex.Message), true); // } //} protected void Save_Click(object sender, EventArgs e) { try { BALItem lcls = new BALItem(); if (txtCurrency.Text == "") { txtCurrency.Style.Add("border", "Solid 1px red"); mpebudget.Show(); } else { lcls.CurrencyName = txtCurrency.Text; string lstrMessage = lclsservice.InsertCurrency(lcls); if (lstrMessage == "Saved Successfully") { EventLogger log = new EventLogger(config); string msg = Constant.MedicalSuppliesSaveCurrencyMessage.Replace("ShowPopup('", "").Replace("<<Itemname>>", txtCurrency.Text).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesSaveCurrencyMessage.Replace("<<Itemname>>", txtCurrency.Text), true); } } txtCurrency.Text = ""; BindUnitPriceCurrency(); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesErrorMessage.Replace("<<Itemname>>", ex.Message), true); } }
protected void chkactive_CheckedChanged(object sender, EventArgs e) { try { GridViewRow row = (sender as CheckBox).Parent.Parent as GridViewRow; CheckBox chkactive = (CheckBox)row.FindControl("chkactive"); InventoryServiceClient lclsService = new InventoryServiceClient(); if (chkactive.Checked == true) { lclsService.DeleteVendor(Convert.ToInt64(row.Cells[2].Text), true, defaultPage.UserId); } else { lclsService.DeleteVendor(Convert.ToInt64(row.Cells[2].Text), false, defaultPage.UserId); EventLogger log = new EventLogger(config); log.LogInformation(msgdelte.Replace("<<Vendor>>", row.Cells[4].Text.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorDeleteMessage.Replace("<<Vendor>>", row.Cells[4].Text.ToString()), true); } BindvendorGrid(); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorErrorMessage.Replace("<<Vendor>>", ex.Message), true); } }
public void SaveCorporate() { try { EventLogger log = new EventLogger(config); bool isvalidcorp = false; bool isvalidcorpdesc = false; ObjCorporate.CorporateName = txtCorporateFullName.Text; ObjCorporate.CorporateDescription = txtCorporateDesc.Text; ObjCorporate.POEmail = txtPOEmail.Text; ObjCorporate.CreatedBy = defaultPage.UserId; List <BindCorporateMaster> lstCor = lclsservice.BindCorporateMaster().Where(a => a.CorporateName == ObjCorporate.CorporateName).ToList(); if (lstCor.Count > 0) { isvalidcorp = true; } else { List <BindCorporateMaster> lstCorpdesc = lclsservice.BindCorporateMaster().Where(a => a.CorporateDescription == ObjCorporate.CorporateDescription).ToList(); if (lstCorpdesc.Count > 0) { isvalidcorpdesc = true; } } if (isvalidcorp == false && isvalidcorpdesc == false) { save = lclsservice.InsertCorporateMaster(ObjCorporate); if (save == "Saved Successfully") { string msg = Constant.CorporateSaveMessage.Replace("ShowPopup('", "").Replace("<<Corporate>>", "").Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.CorporateSaveMessage.Replace("<<Corporate>>", ""), true); BindGrid(); clear(); } } else { if (isvalidcorp == true) { log.LogWarning(msgwrn.Replace("<<Corporate>>", txtCorporateFullName.Text)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningValidCorporateMessage.Replace("<<Corporate>>", txtCorporateFullName.Text), true); } else { log.LogWarning(logmsg.Replace("<<Corporate>>", txtCorporateDesc.Text)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningValidCorporatecdescMessage.Replace("<<Corporate>>", txtCorporateDesc.Text), true); } } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.CorporateErrorMessage.Replace("<<Corporate>>", ex.Message.ToString()), true); } }
protected void btnImgDeletePopUp_Click(object sender, ImageClickEventArgs e) { try { InventoryServiceClient lclsService = new InventoryServiceClient(); lclsService.DeleteItemMapping(Convert.ToInt64(hdnItemMapID.Value), false, Convert.ToInt64(defaultPage.UserId)); EventLogger log = new EventLogger(config); string msg = Constant.VendorItemMapDeleteMessage.Replace("ShowdelPopup('", "").Replace("<<VendorItemMap>>", HddVendorItemCategory.Value).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapDeleteMessage.Replace("<<VendorItemMap>>", HddVendorItemCategory.Value), true); BindGrid(); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); } }
protected void btnImgDeletePopUp_Click(object sender, ImageClickEventArgs e) { try { InventoryServiceClient lclsService = new InventoryServiceClient(); lclsService.DeleteFacilityVendorAccount(Convert.ToInt64(hdnFVAccountID.Value), Convert.ToInt64(defaultPage.UserId), false); EventLogger log = new EventLogger(config); string msg = Constant.FacilityVendorAccountDeleteMessage.Replace("ShowdelPopup('", "").Replace("<<FacilityDescription>>", HddFacilityVendor.Value.ToString()).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountDeleteMessage.Replace("<<FacilityDescription>>", HddFacilityVendor.Value.ToString()), true); BindGrid(); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountErrorMessage.Replace("<<FacilityDescription>>", ex.Message), true); } }
protected void btndeletepop_Click(object sender, EventArgs e) { try { InventoryServiceClient lclsService = new InventoryServiceClient(); string lstrMessage = lclsService.DeleteVendor(Convert.ToInt64(hiddenVendorID.Value), false, defaultPage.UserId); if (lstrMessage == "Deleted Successfully") { BindvendorGrid(); EventLogger log = new EventLogger(config); log.LogInformation(msgdelte.Replace("<<Vendor>>", hdnvendor.Value)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorDeleteMessage.Replace("<<Vendor>>", hdnvendor.Value), true); } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorErrorMessage.Replace("<<Vendor>>", ex.Message), true); } }
protected void btndeletepop_Click(object sender, EventArgs e) { try { EventLogger log = new EventLogger(config); InventoryServiceClient lclsService = new InventoryServiceClient(); string lstrMessage = lclsService.DeleteUom(Convert.ToInt64(Convert.ToInt64(hdnfield.Value)), defaultPage.UserId, false); if (lstrMessage == "Deleted Successfully") { bindUom(); string msg = Constant.UOMDeleteMessage.Replace("ShowdelPopup('", "").Replace("<<UOM>>", hdnuomname.Value).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.UOMDeleteMessage.Replace("<<UOM>>", hdnuomname.Value), true); } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.UOMErrorMessage.Replace("<<UOM>>", ex.Message), true); } }
protected void btnsave_Click(object sender, EventArgs e) { try { EventLogger log = new EventLogger(config); string FacilityVendorAcct = string.Empty; string lstrMessage = string.Empty; InventoryServiceClient service = new InventoryServiceClient(); BALFacilityVendorAccount obj = new BALFacilityVendorAccount(); obj.FacilityVendorAccID = Convert.ToInt64(hdnFVAccountID.Value); obj.FacilityID = Convert.ToInt64(drdFacilityName.SelectedValue); obj.VendorID = Convert.ToInt64(drdVendorName.SelectedValue); obj.ShipAccount = txtShipAccount.Text; obj.BillAccount = txtBillAccount.Text; obj.CreatedBy = defaultPage.UserId; obj.CreatedOn = DateTime.Now; if (chkactive.Checked == true) { obj.IsActive = true; } else { obj.IsActive = false; } if (obj.FacilityVendorAccID == 0) { List <GetFacilityVendorAccount> lstcount = service.GetFacilityVendorAccount(drdFacilityName.SelectedItem.Text).Where(o => o.VendorDescription == drdVendorName.SelectedItem.Text.ToString()).ToList(); if (lstcount.Count <= 0) { lstrMessage = service.InsertUpdateFacilityVendorAccount(obj); FacilityVendorAcct = drdFacilityName.SelectedItem.Text + " " + drdVendorName.SelectedItem.Text; log.LogInformation(msgwrn.Replace("<<FacilityDescription>>", FacilityVendorAcct.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountSaveMessage.Replace("<<FacilityDescription>>", FacilityVendorAcct.ToString()), true); } else { //Functions objfun = new Functions(); //objfun.MessageDialog(this, "Record Exist"); string msg = Constant.WarningFacilityVendorAccountMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<FacilityDescription>>", "Record Exists").Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningFacilityVendorAccountMessage.Replace("<<FacilityDescription>>", "Record Exists"), true); } } else { if (!ValidateLoookups(service)) { return; } List <GetFacilityVendorAccount> lstcount = service.GetFacilityVendorAccount(drdFacilityName.SelectedItem.Text).Where(o => o.VendorDescription == drdVendorName.SelectedItem.Text.ToString() && o.FacilityVendorAccID != obj.FacilityVendorAccID).ToList(); if (lstcount.Count == 0) { lstrMessage = service.InsertUpdateFacilityVendorAccount(obj); FacilityVendorAcct = drdFacilityName.SelectedItem.Text + " " + drdVendorName.SelectedItem.Text; log.LogInformation(msgwrn.Replace("<<FacilityDescription>>", FacilityVendorAcct.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountSaveMessage.Replace("<<FacilityDescription>>", FacilityVendorAcct.ToString()), true); } else { //Functions objfun = new Functions(); //objfun.MessageDialog(this, "The Record Entered is alredy Exist"); string msg = Constant.FacilityVendorAccountErrorMessage.Replace("ShowdelPopup('", "").Replace("<<FacilityDescription>>", "The record entered is already exist").Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountErrorMessage.Replace("<<FacilityDescription>>", "The record entered is already exist"), true); } } if (lstrMessage == "Saved Successfully") { //Functions objfun = new Functions(); //objfun.MessageDialog(this, "Saved Successfully"); //txtSearchFacility.Text = ""; BindGrid(); drdFacilityName.SelectedIndex = 0; drdVendorName.SelectedIndex = 0; txtBillAccount.Text = ""; txtShipAccount.Text = ""; hdnFVAccountID.Value = "0"; ToggleAdd("Clear"); } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.FacilityVendorAccountErrorMessage.Replace("<<FacilityDescription>>", ex.Message), true); } }
protected void btnsave_Click(object sender, EventArgs e) { try { EventLogger log = new EventLogger(config); InventoryServiceClient lclsService = new InventoryServiceClient(); if (hdnfield.Value != "0") { lcls.UomID = Convert.ToInt64(hdnfield.Value); } lcls.UomName = txtUomName.Text; lcls.CreatedBy = defaultPage.UserId; lcls.CreatedOn = DateTime.Now; lcls.LastModifiedBy = defaultPage.UserId; if (chkactive.Checked == true) { lcls.IsActive = true; } else { lcls.IsActive = false; } List <GetUOMName> lstuomname = new List <GetUOMName>(); lstuomname = lclsService.GetUOMName(txtUomName.Text).ToList(); if (lstuomname.Count <= 0) { string lstrMessage = lclsService.InsertUOM(lcls); { List <GetUom> lstUOM = lclsService.GetUom().ToList(); log.LogInformation(msgwrn.Replace("<<UOM>>", txtUomName.Text)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.UOMSaveMessage.Replace("<<UOM>>", txtUomName.Text), true); hdnfield.Value = "0"; } bindUom(); clear(); } else { if (lstuomname[0].UomID == Convert.ToInt64(lcls.UomID)) { string lstrMessage = lclsService.InsertUOM(lcls); { List <GetUom> lstUOM = lclsService.GetUom().ToList(); log.LogInformation(msgwrn.Replace("<<UOM>>", txtUomName.Text)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.UOMSaveMessage.Replace("<<UOM>>", txtUomName.Text), true); hdnfield.Value = "0"; } bindUom(); clear(); } else { string msg = Constant.UOMDeleteMessage.Replace("ShowdelPopup('", "").Replace("<<UOM>>", "Unit Of Measurement value already exists create a new UOM").Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.UOMDeleteMessage.Replace("<<UOM>>", "Unit Of Measurement value already exists create a new UOM"), true); } } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.UOMErrorMessage.Replace("<<UOM>>", ex.Message), true); } }
protected void btnsave_Click(object sender, EventArgs e) { try { EventLogger log = new EventLogger(config); BALItem lcls = new BALItem(); if (ItemID.Value != null && ItemID.Value != "") { lcls.ItemID = Convert.ToInt64(ItemID.Value); } //txtitemid.Text = Convert.ToString(lcls.ItemID); //lcls.ItemShortName = txtitemid.Text; lcls.ItemDescription = txtItemDesc.Text; lcls.CategoryID = Convert.ToInt64(drdItemCategory.SelectedValue); lcls.QtyPack = Convert.ToInt64(txtQty.Text); lcls.NDC = txtNDC.Text; decimal E = 0; E = Convert.ToDecimal(txtunitvalue.Text) / Convert.ToInt64(txtQty.Text); lcls.EachPrice = Convert.ToDecimal(E.ToString()); lcls.UnitPriceCurrency = Convert.ToString(drdUnitpriceType.SelectedValue); lcls.UnitPriceValue = Convert.ToDecimal(txtunitvalue.Text); lcls.UOM = Convert.ToInt64(ddlUOM.SelectedValue); lcls.GPBillingCode = txtgpbill.Text; //if (chkstan.Checked == true) //{ // lcls.Standard = true; //} //else //{ // lcls.Standard = false; //} //if (chknonstan.Checked == true) //{ // lcls.NonStandard = true; //} //else //{ // lcls.NonStandard = false; //} lcls.CreatedBy = defaultPage.UserId; lcls.CreatedOn = DateTime.Now; lcls.LastModifiedBy = defaultPage.UserId; lcls.LastModifiedOn = DateTime.Now; if (!ValidateLoookups(lclsservice)) { return; } bool isdescvalid = false; bool idgpcdoe = false; if (chkactive.Checked == true) { lcls.IsActive = true; } else { lcls.IsActive = false; } List <GetItemDescName> lstitemdesc = lclsservice.GetItemDescName(txtItemDesc.Text).ToList(); if (lstitemdesc.Count <= 0 || txtItemDesc.Text == "") { isdescvalid = true; } else if (lstitemdesc[0].ItemID == Convert.ToInt64(lcls.ItemID)) { isdescvalid = true; } List <Validgpbillcode> lstMaster = lclsservice.Validgpbillcode(txtgpbill.Text).ToList(); if (lstMaster.Count <= 0 || txtgpbill.Text == "") { idgpcdoe = true; } else if (lstMaster[0].ItemID == Convert.ToInt64(lcls.ItemID)) { idgpcdoe = true; } if (isdescvalid == true && idgpcdoe == true) { string lstrMessage = lclsservice.InsertUpdateItem(lcls); string msg = Constant.MedicalSuppliesSaveMessage.Replace("ShowPopup('", "").Replace("<<Itemname>>", txtItemDesc.Text).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesSaveMessage.Replace("<<Itemname>>", txtItemDesc.Text), true); BindItem(); txtSearchItem.Text = ""; Clear(); } else { if (isdescvalid == false) { string msg = Constant.MedicalSuppliesvailddescMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<Itemname>>", txtItemDesc.Text).Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesvailddescMessage.Replace("<<Itemname>>", txtItemDesc.Text), true); } else { string msg = Constant.MedicalSuppliesvaildgpMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<Itemname>>", txtgpbill.Text).Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesvaildgpMessage.Replace("<<Itemname>>", txtgpbill.Text), true); } } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.MedicalSuppliesErrorMessage.Replace("<<Itemname>>", ex.Message), true); } }
protected void btnsave_Click(object sender, EventArgs e) { try { EventLogger log = new EventLogger(config); InventoryServiceClient lclserinven = new InventoryServiceClient(); BALVendor objbalvendor = new BALVendor(); string a = string.Empty; if (hiddenVendorID.Value != null) { objbalvendor.VendorID = Convert.ToInt64(hiddenVendorID.Value); } objbalvendor.VendorUIID = txtvendorID.Text; objbalvendor.VendorName = txtvendorname.Text; //objbalvendor.Street = txtvenstreet.Text; objbalvendor.City = txtcity.Text; objbalvendor.Address1 = txtaddress1.Text; objbalvendor.Address2 = txtaddress2.Text; objbalvendor.State = Convert.ToInt64(ddlState.SelectedValue); objbalvendor.Zip = txtzipcode.Text + "-" + txtzipcode1.Text; //objbalvendor.Country = txtcountry.Text; objbalvendor.Phone = txtphone.Text; if (txtxtn.Text != "") { objbalvendor.Xtn = Convert.ToInt64(txtxtn.Text); } objbalvendor.Fax = txtfax.Text; objbalvendor.ContactName = txtcontactperson.Text; objbalvendor.ContactEmail = txtcontactemail.Text; objbalvendor.ContactPhone = txtcontactph.Text; objbalvendor.POEmail = txtpoemail.Text; objbalvendor.AlternateEmail = txtaltenateemail.Text; if (chkf.Checked) { objbalvendor.All = true; } else { objbalvendor.All = false; } if (chks.Checked) { objbalvendor.ServiceOrder = true; } else { objbalvendor.ServiceOrder = false; } if (chkf.Checked) { objbalvendor.BuildingMaintenance = true; } else { objbalvendor.BuildingMaintenance = false; } if (chkh.Checked) { objbalvendor.RegularSupplies = true; } else { objbalvendor.RegularSupplies = false; } if (chkm.Checked) { objbalvendor.MachineParts = true; } else { objbalvendor.MachineParts = false; } if (chkIT.Checked) { objbalvendor.IT = true; } else { objbalvendor.IT = false; } objbalvendor.CreatedBy = defaultPage.UserId; objbalvendor.UpdatedBy = defaultPage.UserId; if (chkactive.Checked == true) { objbalvendor.IsActive = true; } else { objbalvendor.IsActive = false; } List <GETVendorUniqueName> lstvuname = new List <GETVendorUniqueName>(); lstvuname = lclserinven.GETVendorUniqueName(txtvendorID.Text).ToList(); if (lstvuname.Count <= 0) { a = lclserinven.InsertUpdateVendorDetails(objbalvendor); if (a == "Saved Successfully") { btnprint.Visible = true; log.LogInformation(msgern.Replace("<<Vendor>>", txtvendorname.Text.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorSaveMessage.Replace("<<Vendor>>", txtvendorname.Text.ToString()), true); BindvendorGrid(); clear(); } } else { if (lstvuname[0].VendorID == Convert.ToInt64(objbalvendor.VendorID)) { a = lclserinven.InsertUpdateVendorDetails(objbalvendor); { //Functions objfun = new Functions(); //objfun.MessageDialog(this, "Saved Successfully"); log.LogInformation(msgern.Replace("<<Vendor>>", txtvendorname.Text.ToString())); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorSaveMessage.Replace("<<Vendor>>", txtvendorname.Text.ToString()), true); //ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorErrorMessage.Replace("<<Vendor>>", "Vendor Code already exists create a new code to save"), true); btnprint.Visible = true; hiddenVendorID.Value = "0"; clear(); } BindvendorGrid(); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorErrorMessage.Replace("<<Vendor>>", "Vendor Code already exists create a new code to save"), true); ScriptManager.RegisterStartupScript(this, this.GetType(), "Error", "VendorcodeError();", true); } } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorErrorMessage.Replace("<<Vendor>>", ex.Message), true); } }
protected void btnsave_Click(object sender, EventArgs e) { try { EventLogger log = new EventLogger(config); InventoryServiceClient service = new InventoryServiceClient(); string lstrMessage = string.Empty; string VendorItemMap = string.Empty; string vendordesc = string.Empty; string ErrMsg = string.Empty; BALItemMap obj = new BALItemMap(); if (!ValidateLoookups(service)) { return; } obj.ItemMapID = Convert.ToInt64(hdnItemMapID.Value); obj.ItemID = Convert.ToInt64(drdItemID.SelectedValue); obj.ItemCategory = Convert.ToInt64(drdItemCategory.SelectedValue); obj.VendorID = Convert.ToInt64(drdVendorID.SelectedValue); obj.VendorItemID = txtVendorItemID.Text; obj.CreatedBy = defaultPage.UserId; obj.CreatedOn = DateTime.Now; if (chkactive.Checked == true) { obj.IsActive = true; } else { obj.IsActive = false; } List <GetItemMap> list = new List <GetItemMap>(); list = service.GetItemMap().Where(a => a.ItemIDCk == Convert.ToInt64(drdItemID.SelectedValue)).ToList(); List <GetItemMap> listVendorItemid = new List <GetItemMap>(); listVendorItemid = service.GetItemMap().Where(a => a.VendorItemID == obj.VendorItemID).ToList(); if (list.Count > 0) { if (list[0].ItemMapID != obj.ItemMapID) { ErrMsg = "VIC"; } } if (listVendorItemid.Count > 0) { if (obj.VendorItemID == listVendorItemid[0].VendorItemID && listVendorItemid[0].ItemMapID != obj.ItemMapID) { ErrMsg = "VID"; } } if (ErrMsg == "") { lstrMessage = service.InsertItemMap(obj); } else { if (ErrMsg == "VID" && ErrMsg == "VIC") { vendordesc = drdVendorID.SelectedItem.Text; log.LogInformation(msgwrn.Replace("<<VendorItemMap>>", vendordesc)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningVendorMessage.Replace("<<VendorItemMap>>", vendordesc), true); } else if (ErrMsg == "VIC") { vendordesc = drdVendorID.SelectedItem.Text; log.LogInformation(msgwrn.Replace("<<VendorItemMap>>", vendordesc)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningVendorMessage.Replace("<<VendorItemMap>>", vendordesc), true); } else if (ErrMsg == "VID") { List <GetItemMap> listVendorItemidInActive = new List <GetItemMap>(); listVendorItemidInActive = service.GetItemMap().Where(a => a.VendorItemID == obj.VendorItemID && a.IsActive == false).ToList(); vendordesc = drdVendorID.SelectedItem.Text; if (listVendorItemidInActive.Count > 0) { string msg = Constant.WarningVendorInActiveLookupMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<VendorItemMap>>", vendordesc).Replace("');", ""); log.LogInformation(msg); log.LogInformation(Constant.WarningVendorInActiveLookupMessage.Replace("<<VendorItemMap>>", vendordesc)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningVendorInActiveLookupMessage.Replace("<<VendorItemMap>>", vendordesc), true); } else { string msg = Constant.WarningVendorItemIDMessage.Replace("ShowwarningLookupPopup('", "").Replace("<<VendorItemMap>>", vendordesc).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningVendorItemIDMessage.Replace("<<VendorItemMap>>", vendordesc), true); } } } if (lstrMessage == "Saved Successfully") { //Functions objfun = new Functions(); //objfun.MessageDialog(this, "Saved Successfully"); string msg = Constant.VendorItemMapSaveMessage.Replace("ShowPopup('", "").Replace("<<VendorItemMap>>", txtVendorItemID.Text.ToString()).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapSaveMessage.Replace("<<VendorItemMap>>", txtVendorItemID.Text.ToString()), true); ToggleAdd("Clear"); clear(); BindGrid(); } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); } }
protected void btnsave_Click(object sender, EventArgs e) { try { if (hdnfield.Value != "0") { lcls.CategoryID = Convert.ToInt64(hdnfield.Value); } lcls.CategoryName = txtGroupName.Text; if (chkstan.Checked == true) { lcls.Usage = "1"; } else if (chknonstan.Checked == true) { lcls.Usage = "0"; } else { lcls.Usage = null; } if (chkactive.Checked == true) { lcls.IsActive = true; } else { lcls.IsActive = false; } lcls.CreatedOn = DateTime.Now; lcls.CreatedBy = defaultPage.UserId; lcls.LastModifiedBy = defaultPage.UserId; string ErrMsg = string.Empty; List <GetItemCategory> lstcat = lclsService.GetItemCategory().Where(a => a.CategoryName == txtGroupName.Text).ToList(); if (lstcat.Count > 0) { if (lcls.CategoryID == 0) { ErrMsg = "FC"; } else { if (lcls.CategoryID != lstcat[0].CategoryID) { ErrMsg = "FC"; } } } if (ErrMsg == "") { string lstrMessage = lclsService.InsertUpdateCategory(lcls); EventLogger log = new EventLogger(config); string msg = Constant.ItemCategorySaveMessage.Replace("ShowPopup('", "").Replace("<<ItemCategory>>", txtGroupName.Text).Replace("');", ""); log.LogInformation(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategorySaveMessage.Replace("<<ItemCategory>>", txtGroupName.Text), true); hdnfield.Value = "0"; bindgrid(); clear(); } else { EventLogger log = new EventLogger(config); string msg = Constant.ItemCategoryWarningMessage.Replace("ShowwarningPopup('", "").Replace("<<ItemCategory>>", txtGroupName.Text).Replace("');", ""); log.LogWarning(msg); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategoryWarningMessage.Replace("<<ItemCategory>>", txtGroupName.Text), true); } //Functions objfun = new Functions(); //objfun.MessageDialog(this, "Saved Successfully"); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.ItemCategoryErrorMessage.Replace("<<ItemCategory>>", ex.Message), true); } }
public void UpdateCorporate() { try { EventLogger log = new EventLogger(config); bool iscorp = false; bool isCorpesc = false; ObjCorporate.CorporateID = Convert.ToInt64(HiddenCorporateMasterID.Value); ObjCorporate.CorporateName = txtCorporateFullName.Text; ObjCorporate.CorporateDescription = txtCorporateDesc.Text; ObjCorporate.POEmail = txtPOEmail.Text; ObjCorporate.LastModifiededBy = defaultPage.UserId; if (chkstatus.Checked == true) { ObjCorporate.IsActive = true; } else { ObjCorporate.IsActive = false; } List <BindCorporateMaster> lstCop = lclsservice.BindCorporateMaster().Where(a => a.CorporateName == ObjCorporate.CorporateName).ToList(); if (lstCop.Count <= 0 || txtCorporateFullName.Text == "") { iscorp = true; } else if (lstCop[0].CorporateID == Convert.ToInt64(ObjCorporate.CorporateID)) { iscorp = true; } List <BindCorporateMaster> lstCorpdesc = lclsservice.BindCorporateMaster().Where(a => a.CorporateDescription == ObjCorporate.CorporateDescription).ToList(); if (lstCorpdesc.Count <= 0 || txtCorporateDesc.Text == "") { isCorpesc = true; } else if (lstCorpdesc[0].CorporateID == Convert.ToInt64(ObjCorporate.CorporateID)) { isCorpesc = true; } if (iscorp == true && isCorpesc == true) { update = lclsservice.UpdateCorporateMaster(ObjCorporate); if (update == "Updated Successfully") { string msg = Constant.CorporateUpdateMessage.Replace("ShowPopup('", "").Replace("<<Corporate>>", "").Replace("');", ""); log.LogInformation(msg); //lclsservice.DeleteCorporateDetails(Convert.ToInt64(HiddenCorporateMasterID.Value), true, defaultPage.UserId); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.CorporateUpdateMessage.Replace("<<Corporate>>", ""), true); BindGrid(); clear(); } } else { if (iscorp == false) { log.LogWarning(msgwrn.Replace("<<Corporate>>", txtCorporateFullName.Text)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningValidCorporateMessage.Replace("<<Corporate>>", txtCorporateFullName.Text), true); } else { log.LogWarning(logmsg.Replace("<<Corporate>>", txtCorporateDesc.Text)); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.WarningValidCorporatecdescMessage.Replace("<<Corporate>>", txtCorporateDesc.Text), true); } } } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.CorporateErrorMessage.Replace("<<Corporate>>", ex.Message.ToString()), true); } }