//protected void UploadAttachments(string IndexValue) //{ // // if (Request.QueryString["AthHandle"] != null) // // { // objWorkFlow = new WorkFlow(); // // objWorkFlow.IndexValue = Request.QueryString["Index"]; // objWorkFlow.AttachmentHandle = "J_PREORDER_WORKFLOW"; // DataTable dt = objWorkFlow.GetPath(); // if (dt.Rows.Count > 0) // { // //string ServerPath = "\\\\" + dt.Rows[0]["ServerName"].ToString() + "\\" + dt.Rows[0]["Path"].ToString() + "\\"; //dt.Rows[0]["Path"].ToString() + "\\";// // Server.MapPath("~/Files/");// // string ServerPath = "D:\\" + dt.Rows[0]["t_path"].ToString() + "\\"; //dt.Rows[0]["Path"].ToString() + "\\";// // Server.MapPath("~/Files/");// // if (fileAttachment.HasFile) // { // int filecount = 0; // filecount = fileAttachment.PostedFiles.Count(); // if (filecount > 0) // { // foreach (HttpPostedFile PostedFile in fileAttachment.PostedFiles) // { // string fileName = Path.GetFileNameWithoutExtension(PostedFile.FileName); // string fileExtension = Path.GetExtension(PostedFile.FileName); // try // { // objWorkFlow = new WorkFlow(); // objWorkFlow.AttachmentHandle = "J_PREORDER_WORKFLOW"; // objWorkFlow.IndexValue = IndexValue; // objWorkFlow.PurposeCode = "PreOrderWorkFlow";// Request.QueryString["PurposeCode"]; // objWorkFlow.AttachedBy = Request.QueryString["u"]; // objWorkFlow.FileName = fileName + fileExtension; // objWorkFlow.LibraryCode = dt.Rows[0]["LibCode"].ToString(); // // DataTable dtFile = objWorkFlow.GetFileName(); // // if (dtFile.Rows.Count == 0) // // { // DataTable dtDocID = objWorkFlow.InsertAttachmentdata(); // if (dtDocID.Rows[0][0].ToString() != "0") // { // try // { // fileAttachment.SaveAs(ServerPath + dtDocID.Rows[0][0]); // } // catch (Exception ex) // { // } // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Successfully Uploaded');", true); // } // else // { // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Attachment Handle does not exist');", true); // } // // } // // else // // { // // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('This file name already exist please change your file name');", true); // // } // } // catch (System.Exception ex) // { // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('" + ex.Message + "');", true); // } // } // } // else // { // } // } // else // { // } // } // else // { // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Path does not exist');", true); // } // // } // // else // // { // // ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Data not found Properly');", true); // // } //} #endregion public void SendMail(string MailTo, string UserRandomNo, string EmailSub) { try { // if (fileAttachment.HasFile) // { objWorkFlow = new WorkFlow(); DataTable dtMailTo = objWorkFlow.GetMAilID(Request.QueryString["u"]); string UserMailId = dtMailTo.Rows[0]["EMailid"].ToString(); MailMessage mM = new MailMessage(); mM.From = new MailAddress(UserMailId); // mM.To.Add(txtTo.Text.Trim()); // string[] MailTo = txtTo.Text.Split(';'); // foreach (string Mailid in MailTo) // { // mM.To.Add(new MailAddress(Mailid)); // } mM.To.Add(MailTo); //MailTo mM.To.Add(UserMailId); mM.Subject = EmailSub; //Request.QueryString["Status"] + "-" + txtSpecification.Text; //foreach (HttpPostedFile PostedFile in fileAttachment.PostedFiles) //{ // string fileName = Path.GetFileName(PostedFile.FileName); // Attachment myAttachment = new Attachment(fileAttachment.FileContent, fileName); // mM.Attachments.Add(myAttachment); //} mM.Body = txtNotes.Text; mM.IsBodyHtml = true; mM.Body += "<br /><br /><br /><a href='http://cloud.isgec.co.in/SupWF/SupEnquiryResponseForm.aspx?user="******"'>Vendor Portal for Response Submission </a>"; mM.Body += "<br /> <br /> You are requested to access the Vendor Portal for all communication and exchange of documents."; mM.Body += "<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />This mail has been triggered to draw your attention on the respective ERP/Joomla module. Please login to respective module to see further details and file attachments"; mM.Body = mM.Body.Replace("\n", "<br />"); SmtpClient sC = new SmtpClient("192.9.200.214", 25); // sC.Host = "192.9.200.214"; //"smtp-mail.outlook.com"// smtp.gmail.com // sC.Port = 25; //587 sC.DeliveryMethod = SmtpDeliveryMethod.Network; sC.UseDefaultCredentials = false; sC.Credentials = new NetworkCredential("*****@*****.**", "isgec"); //sC.Credentials = new NetworkCredential("adskvaultadmin", "isgec@123"); sC.EnableSsl = false; // true sC.Timeout = 10000000; sC.Send(mM); //} //else //{ //} } catch (Exception ex) { ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Some technical issue Mail not sent');", true); } //} }
protected void btnNotes_Click(object sender, EventArgs e) { string MailTo = string.Empty; if (Request.QueryString["WFID"] != null) { //Header string Header = string.Empty; if (txtSpecification.Text.Contains("(")) { string[] Heading = txtSpecification.Text.Split('('); Header = Heading[0]; } else { Header = txtSpecification.Text; } if (Request.QueryString["p"] != null && Request.QueryString["p"] == "B") { objWorkFlow = new WorkFlow(); DataTable dtMailTo = objWorkFlow.GetMAilID(hdfUser.Value); MailTo = dtMailTo.Rows[0]["EMailid"].ToString(); } if (Request.QueryString["p"] != null && Request.QueryString["p"] == "U") { string[] Buyer = txtBuyer.Text.Split('-'); string[] manager = txtManager.Text.Split('-'); objWorkFlow = new WorkFlow(); DataTable dtMailBuyerTo = objWorkFlow.GetMAilID(Buyer[1]); DataTable dtMailManagerTo = objWorkFlow.GetMAilID(Buyer[1]); MailTo = dtMailBuyerTo.Rows[0]["EMailid"].ToString() + "," + dtMailManagerTo.Rows[0]["EMailid"].ToString(); } string url = "http://192.9.200.146/Attachment/Notes.aspx?handle=J_PREORDER_WORKFLOW&Index=" + Request.QueryString["WFID"] + "&user="******"u"] + "&Em=" + MailTo + "&Hd=" + Header + "&Tl=" + txtSpecification.Text; string s = "window.open('" + url + "','abc','width=1300,height=700,left=100,top=100,resizable=yes,scrollbars=yes');"; //, 'width=300,height=100,left=100,top=100,resizable=yes' ClientScript.RegisterStartupScript(this.GetType(), "script", s, true); } }
protected void btnClear_Click(object sender, EventArgs e) { LinkButton btn = (LinkButton)sender; string[] Value = btn.CommandArgument.Split('&'); objWorkFlow = new WorkFlow(); objWorkFlow.WFID = Convert.ToInt32(Value[0]); objWorkFlow.UserId = Request.QueryString["u"]; objWorkFlow.WF_Status = "Technically cleared"; int res = objWorkFlow.UpdateWF_Status(); if (res > 0) { InsertPreHistory(objWorkFlow.WFID, "Technically cleared"); DataTable dtMailTo = objWorkFlow.GetMAilID(Value[1]); string MailTo = dtMailTo.Rows[0]["EMailid"].ToString(); SendMail(MailTo); GetData(); ScriptManager.RegisterStartupScript(this, typeof(Page), "alert", "alert('Technically cleared');", true); } }