protected void lblview_Click(object sender, ImageClickEventArgs e) { try { searchdiv.Style.Add("display", "none"); div_ADDContent.Style.Add("display", "block"); itemmap.Style.Add("display", "block"); ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; if (ItemID != null) { ItemID.Value = gvrow.Cells[1].Text.Trim().Replace(" ", ""); } txtitemid.Text = gvrow.Cells[1].Text.Trim().Replace(" ", ""); hdnitemid.Value = Convert.ToString(txtitemid.Text); txtItemDesc.Text = HttpUtility.HtmlDecode(gvrow.Cells[4].Text.Trim().Replace(" ", "")); LoadLookups("Edit"); drdItemCategory.ClearSelection(); drdItemCategory.Items.FindByText(gvrow.Cells[5].Text.Trim().Replace(" ", "")).Selected = true; Label lblValue = grditem.Rows[gvrow.RowIndex].FindControl("lblValue") as Label; txtunitvalue.Text = string.Format("{0:F2}", lblValue.Text).ToString(); ddlUOM.ClearSelection(); if (gvrow.Cells[7].Text == " ") { ddlUOM.Items.FindByText("Select").Selected = true; } else { ddlUOM.Items.FindByText(gvrow.Cells[7].Text.Trim().Replace(" ", "")).Selected = true; } txtQty.Text = gvrow.Cells[8].Text.Trim().Replace(" ", ""); Label lblCurrency = grditem.Rows[gvrow.RowIndex].FindControl("lblCurrency") as Label; drdUnitpriceType.ClearSelection(); if (lblCurrency.Text == "") { drdUnitpriceType.Items.FindByText("Select").Selected = true; } else { drdUnitpriceType.Items.FindByText(lblCurrency.Text).Selected = true; } Label lblActive = (Label)gvrow.FindControl("lblActive"); if (lblActive.Text == "Yes") { chkactive.Visible = false; } else { chkactive.Visible = true; } decimal de = Convert.ToDecimal(gvrow.Cells[10].Text.Trim().Replace(" ", "")); txtEachprice.Text = string.Format("{0:F2}", de).ToString(); txtNDC.Text = gvrow.Cells[11].Text.Trim().Replace(" ", ""); txtgpbill.Text = gvrow.Cells[14].Text.Trim().Replace(" ", ""); btnprintdetail.Visible = false; btnsave.Visible = false; btnsave.Enabled = false; btnprintdetail.Enabled = false; lnkPrice.Enabled = false; txtItemDesc.Enabled = false; drdItemCategory.Enabled = false; txtQty.Enabled = false; ddlUOM.Enabled = false; txtunitvalue.Enabled = false; drdUnitpriceType.Enabled = false; txtEachprice.Enabled = false; txtNDC.Enabled = false; txtgpbill.Enabled = false; Save.Enabled = false; binditemmap(); } 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); 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 btnprintsummary_Click(object sender, EventArgs e) { try { BALItem lcls = new BALItem(); List <GetItemSummaryReport> list = new List <GetItemSummaryReport>(); foreach (ListItem lst in drpitemcategory.Items) { if (lst.Selected && drpitemcategory.SelectedValue != "All") { SB.Append(lst.Value + ','); } } if (SB.ToString() != "") { lcls.CategorylistID = SB.ToString().Substring(0, (SB.Length - 1)); } SB.Clear(); if (txtSearchItem.Text != "") { lcls.ItemID = Convert.ToInt64(txtSearchItem.Text); } if (textsearchdesc.Text != "") { lcls.ItemDescription = textsearchdesc.Text; } lcls.IsStrActive = reactive.SelectedValue; lcls.LoggedinBy = defaultPage.UserId; lcls.Filter = ""; List <GetItemSummaryReport> llstreview = lclsservice.GetItemSummaryReport(lcls).ToList(); rvitemsummaryreport.ProcessingMode = ProcessingMode.Local; rvitemsummaryreport.LocalReport.ReportPath = Server.MapPath("~/Reports/ItemSummaryReport.rdlc"); ReportDataSource datasource = new ReportDataSource("GetItemSummaryReportDS", llstreview); rvitemsummaryreport.LocalReport.DataSources.Clear(); rvitemsummaryreport.LocalReport.DataSources.Add(datasource); rvitemsummaryreport.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = rvitemsummaryreport.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); Guid guid = Guid.NewGuid(); string path = ConfigurationManager.AppSettings["TempFileLocation"].ToString(); _sessionPDFFileName = "ItemSummary" + guid + ".pdf"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path, _sessionPDFFileName); using (StreamWriter sw = new StreamWriter(File.Create(path))) { sw.Write(""); } FileStream fs = new FileStream(path, FileMode.Open); // byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); ShowPDFFile(path); } 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 lbedit_Click(object sender, EventArgs e) { try { //Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "ShowContent();", true); //btnprint.Visible = false; ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; ViewState["VendorID"] = gvrow.Cells[2].Text.Trim().Replace(" ", ""); hiddenVendorID.Value = gvrow.Cells[2].Text.Trim().Replace(" ", ""); txtvendorID.Text = gvrow.Cells[3].Text.Trim().Replace(" ", ""); txtvendorname.Text = gvrow.Cells[4].Text.Trim().Replace(" ", ""); // txtvenstreet.Text = gvrow.Cells[4].Text; txtaddress1.Text = gvrow.Cells[5].Text.Trim().Replace(" ", ""); txtaddress2.Text = gvrow.Cells[6].Text.Trim().Replace(" ", ""); txtcity.Text = gvrow.Cells[7].Text.Trim().Replace(" ", ""); ddlState.ClearSelection(); if (gvrow.Cells[8].Text == " ") { ddlState.Items.FindByText("Select").Selected = true; } else { ddlState.SelectedValue = gvrow.Cells[8].Text.Trim().Replace(" ", ""); } //ddlState.SelectedValue = gvrow.Cells[8].Text.Trim().Replace(" ", ""); //txtstate.Text = gvrow.Cells[8].Text.Trim().Replace(" ", ""); txtzipcode.Text = gvrow.Cells[9].Text.Trim().Replace(" ", ""); if (txtzipcode.Text != "") { string[] a = txtzipcode.Text.Split('-'); txtzipcode.Text = a[0].ToString(); if (a.Length >= 2) { txtzipcode1.Text = a[1].ToString(); } } // txtcountry.Text = gvrow.Cells[10].Text.Trim().Replace(" ", ""); txtphone.Text = gvrow.Cells[10].Text.Trim().Replace(" ", ""); txtfax.Text = gvrow.Cells[13].Text.Trim().Replace(" ", ""); txtcontactperson.Text = gvrow.Cells[11].Text.Trim().Replace(" ", ""); txtcontactph.Text = gvrow.Cells[12].Text.Trim().Replace(" ", ""); txtcontactemail.Text = gvrow.Cells[14].Text.Trim().Replace(" ", ""); txtpoemail.Text = gvrow.Cells[15].Text.Trim().Replace(" ", ""); txtaltenateemail.Text = gvrow.Cells[16].Text.Trim().Replace(" ", ""); Label lblAll = (Label)gvrow.FindControl("lblall"); Label lblRegularSupplies = (Label)gvrow.FindControl("lblregularsuplies"); Label lblMachineParts = (Label)gvrow.FindControl("lblMachineparts"); Label lblServiceOrder = (Label)gvrow.FindControl("lblserviceorder"); Label lblBuildingMaintenance = (Label)gvrow.FindControl("lblBuildingMaintenance"); Label lblIT = (Label)gvrow.FindControl("lblIT"); Label lblXtn = (Label)gvrow.FindControl("lblXtn"); if (lblAll.Text != "") { if (Convert.ToBoolean(lblAll.Text) == true) { chkf.Checked = true; } else { chkf.Checked = false; } } if (lblRegularSupplies.Text != "") { if (Convert.ToBoolean(lblRegularSupplies.Text) == true) { chkh.Checked = true; } else { chkh.Checked = false; } } if (lblMachineParts.Text != "") { if (Convert.ToBoolean(lblMachineParts.Text) == true) { chkm.Checked = true; } else { chkm.Checked = false; } } if (lblServiceOrder.Text != "") { if (Convert.ToBoolean(lblServiceOrder.Text) == true) { chks.Checked = true; } else { chks.Checked = false; } } if (lblBuildingMaintenance.Text != "") { if (Convert.ToBoolean(lblBuildingMaintenance.Text) == true) { chkBM.Checked = true; } else { chkBM.Checked = false; } } if (lblIT.Text != "") { if (Convert.ToBoolean(lblIT.Text) == true) { chkIT.Checked = true; } else { chkIT.Checked = false; } } if (lblXtn.Text == "0") { txtxtn.Text = ""; } else { txtxtn.Text = lblXtn.Text.Trim().Replace(" ", ""); } Label lblActive = (Label)gvrow.FindControl("lblActive"); if (lblActive.Text == "Yes") { chkactive.Visible = false; } else { chkactive.Visible = true; } //Mpevendor.Show(); // divaddven.Style.Add("Display", "block"); //Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "ShowContent();", true); //btnaddnew.Visible = false; div_searchContent.Style.Add("display", "none"); divsearchgrid.Style.Add("display", "none"); div_ADDContent.Style.Add("display", "block"); btnprintdt.Visible = true; btnprint.Visible = false; } 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 btnprint_Click(object sender, EventArgs e) { try { if (txtSearchVendor.Text == "") { lcls.VendorUIID = null; } else { lcls.VendorUIID = txtSearchVendor.Text; } if (txtSearchdesc.Text == "") { lcls.VendorName = null; } else { lcls.VendorName = txtSearchdesc.Text; } lcls.IsStrActive = reactive.SelectedValue; lcls.LoggedinBy = defaultPage.UserId; lcls.Filter = ""; List <GetVendorReport> llstreview = lclsservice.GetVendorReport(lcls).ToList(); rvvendorreport.ProcessingMode = ProcessingMode.Local; rvvendorreport.LocalReport.ReportPath = Server.MapPath("~/Reports/VendorSummaryReport.rdlc"); ReportDataSource datasource = new ReportDataSource("VendorReportDS", llstreview); rvvendorreport.LocalReport.DataSources.Clear(); rvvendorreport.LocalReport.DataSources.Add(datasource); rvvendorreport.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = rvvendorreport.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); Guid guid = Guid.NewGuid(); string path = ConfigurationManager.AppSettings["TempFileLocation"].ToString(); _sessionPDFFileName = "VendorSummary" + guid + ".pdf"; if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } path = Path.Combine(path, _sessionPDFFileName); using (StreamWriter sw = new StreamWriter(File.Create(path))) { sw.Write(""); } FileStream fs = new FileStream(path, FileMode.Open); // byte[] data = new byte[fs.Length]; fs.Write(bytes, 0, bytes.Length); fs.Close(); ShowPDFFile(path); } 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 List <object> PrintVendorItemMapping() { try { List <object> llstarg = new List <object>(); List <BindVendorItemMapReport> llstreview = null; BindGrid(); foreach (ListItem lst in drpVendorSearch.Items) { if (lst.Selected && drpVendorSearch.SelectedValue != "All") { SB.Append(lst.Value + ','); } } if (SB.ToString() != "") { listItemMap.ListVendorID = SB.ToString().Substring(0, (SB.Length - 1)); } //var DrpVendorSearch = Array.ConvertAll<string, Int64>(FinalOut.Split(','), Convert.ToInt64); SB.Clear(); foreach (ListItem lst in drpItemCategorySearch.Items) { if (lst.Selected && drpVendorSearch.SelectedValue != "All") { SB.Append(lst.Value + ','); } } if (SB.ToString() != "") { listItemMap.ListItemCategory = SB.ToString().Substring(0, (SB.Length - 1)); } //var DrpItemCategorySearch = Array.ConvertAll<string, Int64>(FinalOut.Split(','), Convert.ToInt64); //list = (from p in service.GetItemMap() where DrpVendorSearch.Contains(inq[0]) select p).ToList(); //list = service.GetItemMap().Where(a => DrpVendorSearch.Contains(a.CategoryID) || a.VendorID == Convert.ToInt64(drpVendorSearch.SelectedValue)).ToList(); SB.Clear(); listItemMap.IsStrActive = rdbstatus.SelectedValue; listItemMap.LoggedIN = defaultPage.UserId; listItemMap.Filter = ""; llstreview = lclsservice.BindVendorItemMapReport(listItemMap).ToList(); //List<GetMedicalSupplyPoReportDetails> llstreview = lclsservice.GetMedicalSupplyPoReportDetails(PRmasterID, null, defaultPage.UserId).ToList(); rvVendorItemMapreport.ProcessingMode = ProcessingMode.Local; rvVendorItemMapreport.LocalReport.ReportPath = Server.MapPath("~/Reports/VendorItemMapSummary.rdlc"); ReportDataSource datasource = new ReportDataSource("VendorItemMapReportDS", llstreview); rvVendorItemMapreport.LocalReport.DataSources.Clear(); rvVendorItemMapreport.LocalReport.DataSources.Add(datasource); rvVendorItemMapreport.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = null; bytes = rvVendorItemMapreport.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); llstarg.Insert(0, bytes); return(llstarg); } catch (Exception ex) { EventLogger log = new EventLogger(config); log.LogException(ex); ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); return(null); } }
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 imgbtnview_Click(object sender, ImageClickEventArgs e) //{ // try // { // ToggleAdd("Add"); // DivSearch.Style.Add("display", "block"); // BindGrid("NonSearch"); // InventoryServiceClient service = new InventoryServiceClient(); // ImageButton btndetails = sender as ImageButton; // GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; // if (hdnItemMapID != null) // hdnItemMapID.Value = gvrow.Cells[1].Text.Trim().Replace(" ", ""); // LoadLookups("Edit"); // drdItemCategory.ClearSelection(); // drdItemCategory.Items.FindByText(gvrow.Cells[2].Text.Trim().Replace(" ", "")).Selected = true; // //if (drdItemID.se == null) // //{ // // drdItemID.SelectedIndex = 0; // //} // if (drdItemCategory.SelectedIndex > 0) // { // BindItem("Edit"); // drdItemID.ClearSelection(); // //drdItemID.Items.FindByText(gvrow.Cells[3].Text.Trim().Replace(" ", "")).Selected = true; // drdItemID.Items.FindByText(HttpUtility.HtmlDecode(gvrow.Cells[3].Text.Trim().Replace(" ", ""))).Selected = true; // } // drdVendorID.ClearSelection(); // drdVendorID.Items.FindByText(gvrow.Cells[4].Text.Trim().ToString()).Selected = true; // txtVendorItemID.Text = gvrow.Cells[5].Text.Trim().Replace(" ", ""); // BindGrid("Search"); // HideAndShowControls("View"); // //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowContent", "editfacility();", true); // } // catch (Exception ex) // { // ScriptManager.RegisterStartupScript(this, this.GetType(), "alert", Constant.VendorItemMapErrorMessage.Replace("<<VendorItemMap>>", ex.Message), true); // } //} protected void lbedit_Click(object sender, ImageClickEventArgs e) { try { ToggleAdd("Add"); HideAndShowControls("Edit"); btnCancel.Visible = false; //DivSearch.Style.Add("display", "block"); //BindGrid("NonSearch"); InventoryServiceClient service = new InventoryServiceClient(); ImageButton btndetails = sender as ImageButton; GridViewRow gvrow = (GridViewRow)btndetails.NamingContainer; if (hdnItemMapID != null) { hdnItemMapID.Value = gvrow.Cells[1].Text.Trim().Replace(" ", ""); } //LoadLookups("Edit"); BindCategoryadd("Edit"); drdItemCategory.ClearSelection(); if (drdItemCategory.Items.FindByText(gvrow.Cells[2].Text.Trim().Replace(" ", "")) != null) { drdItemCategory.Items.FindByValue(drdItemCategory.Items.FindByText(gvrow.Cells[2].Text.Trim().Replace(" ", "")).Value).Selected = true; } //if (drdItemID.se == null) //{ // drdItemID.SelectedIndex = 0; //} if (drdItemCategory.SelectedIndex > 0) { BindItem("Edit"); drdItemID.ClearSelection(); //drdItemID.Items.FindByText(gvrow.Cells[3].Text.Trim().Replace(" ", "")).Selected = true; if (drdItemID.Items.FindByText(HttpUtility.HtmlDecode(gvrow.Cells[8].Text.Trim().Replace(" ", ""))) != null) { drdItemID.Items.FindByValue(drdItemID.Items.FindByText(HttpUtility.HtmlDecode(gvrow.Cells[8].Text.Trim().Replace(" ", ""))).Value).Selected = true; } } BindVendoradd("Edit"); drdVendorID.ClearSelection(); if (drdVendorID.Items.FindByText(gvrow.Cells[5].Text.Trim().Replace(" ", "")) != null) { drdVendorID.Items.FindByValue(drdVendorID.Items.FindByText(gvrow.Cells[5].Text.Trim().Replace(" ", "")).Value).Selected = true; } //drdVendorID.SelectedValue = drdVendorID.Items.FindByText(gvrow.Cells[4].Text.Trim().Replace(" ", "")).Value; txtVendorItemID.Text = gvrow.Cells[6].Text.Trim().Replace(" ", ""); Label lblActive = (Label)gvrow.FindControl("lblActive"); if (lblActive.Text == "Yes") { chkactive.Visible = false; DivCheckBox.Style.Add("display", "none"); } else { chkactive.Visible = true; DivCheckBox.Style.Add("display", "block"); } BindGrid(); //ScriptManager.RegisterStartupScript(this, this.GetType(), "ShowContent", "editfacility();", true); } 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 { 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); } }
public void BindGrid() { try { foreach (ListItem lst in drpVendorSearch.Items) { if (lst.Selected && drpVendorSearch.SelectedValue != "All") { SB.Append(lst.Value + ','); } } if (SB.ToString() != "") { listItemMap.ListVendorID = SB.ToString().Substring(0, (SB.Length - 1)); } //var DrpVendorSearch = Array.ConvertAll<string, Int64>(FinalOut.Split(','), Convert.ToInt64); SB.Clear(); foreach (ListItem lst in drpItemCategorySearch.Items) { if (lst.Selected && drpVendorSearch.SelectedValue != "All") { SB.Append(lst.Value + ','); } } if (SB.ToString() != "") { listItemMap.ListItemCategory = SB.ToString().Substring(0, (SB.Length - 1)); } //var DrpItemCategorySearch = Array.ConvertAll<string, Int64>(FinalOut.Split(','), Convert.ToInt64); //list = (from p in service.GetItemMap() where DrpVendorSearch.Contains(inq[0]) select p).ToList(); //list = service.GetItemMap().Where(a => DrpVendorSearch.Contains(a.CategoryID) || a.VendorID == Convert.ToInt64(drpVendorSearch.SelectedValue)).ToList(); SB.Clear(); listItemMap.IsStrActive = rdbstatus.SelectedValue; listItemMap.LoggedIN = defaultPage.UserId; listItemMap.Filter = ""; List <SearchVendorItemMap> list = new List <SearchVendorItemMap>(); list = lclsservice.GetVendorItemMap(listItemMap).ToList(); //lblrowcount.Text = "No of records : " + list.Count.ToString(); gridItems.DataSource = list; gridItems.DataBind(); //if (drpVendorSearch.SelectedIndex == 0 && drpItemCategorySearch.SelectedIndex == 0) //{ // InventoryServiceClient service = new InventoryServiceClient(); // List<GetItemMap> list = new List<GetItemMap>(); // list = service.GetItemMap().ToList(); // gridItems.DataSource = list; // gridItems.DataBind(); //} //else if (drpVendorSearch.SelectedIndex == 0 || drpItemCategorySearch.SelectedIndex == 0) //{ // InventoryServiceClient service = new InventoryServiceClient(); // List<GetItemMap> list = new List<GetItemMap>(); // list = service.GetItemMap().Where(a => a.CategoryID == Convert.ToInt64(drpItemCategorySearch.SelectedValue) || a.VendorID == Convert.ToInt64(drpVendorSearch.SelectedValue)).ToList(); // gridItems.DataSource = list; // gridItems.DataBind(); //} //else //{ // InventoryServiceClient service = new InventoryServiceClient(); // List<GetItemMap> list = new List<GetItemMap>(); // list = service.GetItemMap().Where(a => a.CategoryID == Convert.ToInt64(drpItemCategorySearch.SelectedValue) && a.VendorID == Convert.ToInt64(drpVendorSearch.SelectedValue)).ToList(); // gridItems.DataSource = list; // gridItems.DataBind(); //} } 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); } }