public static string[] GetCompletionItemNameList(string prefixText, int count, string contextKey) { DMRequisitionCafeteria Obj_RequisitionCafeteria = new DMRequisitionCafeteria(); String[] SearchList = Obj_RequisitionCafeteria.GetSuggestedRecordItems(prefixText, ""); return(SearchList); }
protected void TxtItemName_TextChanged(object sender, EventArgs e) { try { DMRequisitionCafeteria Obj_RequisitionCafeteria = new DMRequisitionCafeteria(); StrCondition = string.Empty; StrCondition = TxtItemName.Text.Trim(); Ds = new DataSet(); Ds = Obj_RequisitionCafeteria.GetItems(StrCondition, "", out StrError); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { TxtItemName.Text = Ds.Tables[0].Rows[0]["ItemName"].ToString(); TxtItemName.ToolTip = Ds.Tables[0].Rows[0]["ItemId"].ToString(); ddlItemName.SelectedValue = Ds.Tables[0].Rows[0]["ItemId"].ToString(); Ds = null; } else { TxtItemName.Text = ""; TxtItemName.ToolTip = "0"; } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void CALLPDF() { DMRequisitionCafeteria obj_RequisitionCafeteria = new DMRequisitionCafeteria(); DataSet dslogin = new DataSet(); int POId = Convert.ToInt32(Request.QueryString["Id"]); string StrError = string.Empty; dslogin = obj_RequisitionCafeteria.BindForReport(POId, out StrError); dslogin.Tables[0].TableName = "REQUESTMASTER"; dslogin.Tables[1].TableName = "REQUESTDETAILS"; dslogin.Tables[2].TableName = "COMPANY"; //----------------------------Image Print--------------------------------------------------------------- string Image = dslogin.Tables[2].Rows[0]["CLogo"].ToString(); string ImageSign = dslogin.Tables[2].Rows[0]["DigitalSignature"].ToString(); string ImageSign1 = dslogin.Tables[2].Rows[0]["DigitalSignature1"].ToString(); string ImageSign2 = dslogin.Tables[2].Rows[0]["DigitalSignature2"].ToString(); dslogin.Tables[2].Columns.Add("CompanyLogo", System.Type.GetType("System.Byte[]")); dslogin.Tables[2].Columns.Add("Sign1", System.Type.GetType("System.Byte[]")); dslogin.Tables[2].Columns.Add("Sign2", System.Type.GetType("System.Byte[]")); dslogin.Tables[2].Columns.Add("Sign3", System.Type.GetType("System.Byte[]")); Image = Image.Replace("~", ""); Image = Image.Replace("/", "\\"); ImageSign = ImageSign.Replace("~", ""); ImageSign = ImageSign.Replace("/", "\\"); ImageSign1 = ImageSign1.Replace("~", ""); ImageSign1 = ImageSign1.Replace("/", "\\"); ImageSign2 = ImageSign2.Replace("~", ""); ImageSign2 = ImageSign2.Replace("/", "\\"); FileStream fs; BinaryReader br; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + Image)) { fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + Image, FileMode.Open); br = new BinaryReader(fs); byte[] imgbyte = new byte[fs.Length + 1]; imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length))); dslogin.Tables[2].Rows[0]["CompanyLogo"] = imgbyte; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["CompanyLogo"] = imgbyte; br.Close(); fs.Close(); } FileStream fss1; BinaryReader brs1; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageSign)) { fss1 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageSign, FileMode.Open); brs1 = new BinaryReader(fss1); byte[] imgbyte1 = new byte[fss1.Length + 1]; imgbyte1 = brs1.ReadBytes(Convert.ToInt32((fss1.Length))); dslogin.Tables[2].Rows[0]["Sign1"] = imgbyte1; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["Sign1"] = imgbyte1; brs1.Close(); fss1.Close(); } FileStream fss2; BinaryReader brs2; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageSign1)) { fss2 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageSign1, FileMode.Open); brs2 = new BinaryReader(fss2); byte[] imgbyte2 = new byte[fss2.Length + 1]; imgbyte2 = brs2.ReadBytes(Convert.ToInt32((fss2.Length))); dslogin.Tables[2].Rows[0]["Sign2"] = imgbyte2; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["Sign2"] = imgbyte2; brs2.Close(); fss2.Close(); } FileStream fss3; BinaryReader brs3; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageSign2)) { fss3 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageSign2, FileMode.Open); brs3 = new BinaryReader(fss3); byte[] imgbyte3 = new byte[fss3.Length + 1]; imgbyte3 = brs3.ReadBytes(Convert.ToInt32((fss3.Length))); dslogin.Tables[2].Rows[0]["Sign3"] = imgbyte3; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["Sign3"] = imgbyte3; brs3.Close(); fss3.Close(); } //------------------------------------------------------------------------------------------- CRpt.Load(Server.MapPath("~/CrystalPrint/REQUEST.rpt")); CRpt.SetDataSource(dslogin); string PDFMaster = Server.MapPath(@"~/TempFiles/" + "PREREQUISITION - " + (DateTime.Now).ToString("dd-MMM-yyyy") + ".pdf"); CRpt.ExportToDisk(ExportFormatType.PortableDocFormat, PDFMaster); WebClient client = new WebClient(); Byte[] buffer = client.DownloadData(PDFMaster); if (buffer != null) { Response.ContentType = "application/pdf"; Response.AddHeader("content-length", buffer.Length.ToString()); Response.BinaryWrite(buffer); } }
//User Right Function=========== #endregion public void SendMail(int reqid) { try { DataSet dslogin = new DataSet(); Ds = new DataSet(); DMRequisitionCafeteria Obj_RequisitionCafeteria = new DMRequisitionCafeteria(); Ds = Obj_RequisitionCafeteria.GETDATAFORMAIL(reqid, out StrError); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { //-------------------------------------------------[Mail Code]------------------------------------------------- string smtpServer = "smtp.gmail.com"; string userName = "******"; string password = "******"; //string smtpServer = "smtp.mail.yahoo.com";//localhost //string userName = "******";//[email protected] //string password = "******";//saprapune@12345 int cdoBasic = 1; int cdoSendUsingPort = 2; MailMessage msg = new MailMessage(); if (userName.Length > 0) { msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserver", smtpServer); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpserverport", 465); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusing", cdoSendUsingPort); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", cdoBasic); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", userName); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", password); msg.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpusessl", true); } msg.To = "*****@*****.**"; // msg.To="*****@*****.**"; //if (txtCC.Text != "") //{ // msg.Cc = txtCC.Text; //} //if (txtBcc.Text != "") //{ // msg.Bcc = txtBcc.Text; //} msg.From = "*****@*****.**"; // msg.From = "*****@*****.**"; msg.Subject = "Material Request From " + Ds.Tables[0].Rows[0]["Employee"].ToString().ToUpper() + " (" + Ds.Tables[0].Rows[0]["Site"].ToString() + " )-( REQ. NO. : " + Ds.Tables[0].Rows[0]["RequisitionNo"].ToString() + " ) Has Been Approved"; string mystring = "Hello Sir,<br/> Request No. : " + Ds.Tables[0].Rows[0]["RequisitionNo"].ToString() + "<br/>" + "Request Date :" + Ds.Tables[0].Rows[0]["ReqDate"].ToString() + "<br/> Please Check This Request For PO"; mystring = mystring.Replace("<br/>", System.Environment.NewLine); msg.Body = mystring.ToString(); SmtpMail.SmtpServer = smtpServer; SmtpMail.Send(msg); } // -------------------------------------------------[End Mail Code]------------------------------------------------- } catch (Exception) { } }
public string GETPDF(int reqid) { DMRequisitionCafeteria obj_RequisitionCafeteria = new DMRequisitionCafeteria(); string StrError = string.Empty; string PDFMaster = string.Empty; ReportDocument CRpt = new ReportDocument(); DataSet dslogin = new DataSet(); dslogin = obj_RequisitionCafeteria.BindForReport(reqid, out StrError); dslogin.Tables[0].TableName = "REQUESTMASTER"; DataTable dt0 = new DataTable(); dt0 = dslogin.Tables[0]; dslogin.Tables[1].TableName = "REQUESTDETAILS"; DataTable dt1 = new DataTable(); dt1 = dslogin.Tables[1]; dslogin.Tables[2].TableName = "COMPANY"; DataTable dt2 = new DataTable(); dt2 = dslogin.Tables[2]; //----------------------------Image Print--------------------------------------------------------------- string Image = dslogin.Tables[2].Rows[0]["CLogo"].ToString(); string ImageSign = dslogin.Tables[2].Rows[0]["DigitalSignature"].ToString(); string ImageSign1 = dslogin.Tables[2].Rows[0]["DigitalSignature1"].ToString(); string ImageSign2 = dslogin.Tables[2].Rows[0]["DigitalSignature2"].ToString(); dslogin.Tables[2].Columns.Add("CompanyLogo", System.Type.GetType("System.Byte[]")); dslogin.Tables[2].Columns.Add("Sign1", System.Type.GetType("System.Byte[]")); dslogin.Tables[2].Columns.Add("Sign2", System.Type.GetType("System.Byte[]")); dslogin.Tables[2].Columns.Add("Sign3", System.Type.GetType("System.Byte[]")); Image = Image.Replace("~", ""); Image = Image.Replace("/", "\\"); ImageSign = ImageSign.Replace("~", ""); ImageSign = ImageSign.Replace("/", "\\"); ImageSign1 = ImageSign1.Replace("~", ""); ImageSign1 = ImageSign1.Replace("/", "\\"); ImageSign2 = ImageSign2.Replace("~", ""); ImageSign2 = ImageSign2.Replace("/", "\\"); FileStream fs; BinaryReader br; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + Image)) { fs = new FileStream(AppDomain.CurrentDomain.BaseDirectory + Image, FileMode.Open); br = new BinaryReader(fs); byte[] imgbyte = new byte[fs.Length + 1]; imgbyte = br.ReadBytes(Convert.ToInt32((fs.Length))); dslogin.Tables[2].Rows[0]["CompanyLogo"] = imgbyte; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["CompanyLogo"] = imgbyte; br.Close(); fs.Close(); } FileStream fss1; BinaryReader brs1; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageSign)) { fss1 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageSign, FileMode.Open); brs1 = new BinaryReader(fss1); byte[] imgbyte1 = new byte[fss1.Length + 1]; imgbyte1 = brs1.ReadBytes(Convert.ToInt32((fss1.Length))); dslogin.Tables[2].Rows[0]["Sign1"] = imgbyte1; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["Sign1"] = imgbyte1; brs1.Close(); fss1.Close(); } FileStream fss2; BinaryReader brs2; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageSign1)) { fss2 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageSign1, FileMode.Open); brs2 = new BinaryReader(fss2); byte[] imgbyte2 = new byte[fss2.Length + 1]; imgbyte2 = brs2.ReadBytes(Convert.ToInt32((fss2.Length))); dslogin.Tables[2].Rows[0]["Sign2"] = imgbyte2; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["Sign2"] = imgbyte2; brs2.Close(); fss2.Close(); } FileStream fss3; BinaryReader brs3; if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + ImageSign2)) { fss3 = new FileStream(AppDomain.CurrentDomain.BaseDirectory + ImageSign2, FileMode.Open); brs3 = new BinaryReader(fss3); byte[] imgbyte3 = new byte[fss3.Length + 1]; imgbyte3 = brs3.ReadBytes(Convert.ToInt32((fss3.Length))); dslogin.Tables[2].Rows[0]["Sign3"] = imgbyte3; dslogin.Tables[2].Rows[dslogin.Tables[2].Rows.Count - 1]["Sign3"] = imgbyte3; brs3.Close(); fss3.Close(); } //------------------------------------------------------------------------------------------- CRpt.Load(Server.MapPath("~/CrystalPrint/REQUEST.rpt")); CRpt.SetDataSource(dslogin); string DATE = DateTime.Now.ToString("dd-MMM-yyyy ss"); PDFMaster = Server.MapPath(@"~/TempFiles/" + "REQUISITION - " + DATE + ".pdf"); CRpt.ExportToDisk(ExportFormatType.PortableDocFormat, PDFMaster); CHKATTACHBROUCHER.Checked = true; CHKATTACHBROUCHER.Text = "Indent Details"; CHKATTACHBROUCHER.ToolTip = PDFMaster; iframepdf.Attributes.Add("src", "../TempFiles/" + "REQUISITION - " + (DATE) + ".pdf"); return(PDFMaster); }