//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 btnprintdetail_Click(object sender, EventArgs e) { try { BALItem lcls = new BALItem(); lcls.ItemID = Convert.ToInt64(hdnitemid.Value); lcls.LoggedinBy = defaultPage.UserId; lcls.Filter = ""; List <GetItemDetailsReport_Result> llstdetailreview = lclsservice.GetItemDetailsReport(lcls).ToList(); rvitemdetailreport.ProcessingMode = ProcessingMode.Local; rvitemdetailreport.LocalReport.ReportPath = Server.MapPath("~/Reports/ItemDetailsReport.rdlc"); ReportDataSource datasource = new ReportDataSource("GetItemDetailsReportDS", llstdetailreview); rvitemdetailreport.LocalReport.DataSources.Clear(); rvitemdetailreport.LocalReport.DataSources.Add(datasource); rvitemdetailreport.LocalReport.Refresh(); Warning[] warnings; string[] streamids; string mimeType; string encoding; string extension; byte[] bytes = rvitemdetailreport.LocalReport.Render("PDF", "", out mimeType, out encoding, out extension, out streamids, out warnings); Guid guid = Guid.NewGuid(); string path = ConfigurationManager.AppSettings["TempFileLocation"].ToString(); _sessionPDFFileName = "ItemDetails" + 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); } }
public void search() { try { BALItem lcls = new BALItem(); List <GetItemSummaryReport_Result> list = new List <GetItemSummaryReport_Result>(); if (rditem.Checked == true) { drpitemcategory.ClearSelection(); rditemid.Enabled = true; } 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_Result> lstcol = lclsservice.GetItemSummaryReport(lcls).ToList(); //lblrowcount.Text = "No of records : " + lstcol.Count.ToString(); grditem.DataSource = lstcol; grditem.DataBind(); } 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_Result> list = new List <GetItemSummaryReport_Result>(); 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_Result> 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 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_Result> 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_Result> 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); } }