protected void btnSendMail_Click(object sender, EventArgs e) { try { DataView dv; DataTable dt; string emailID; string trans_no; string B_STORE_ID; string B_STORE; string type_id = "2"; string uname = Session["USER_NAME"].ToString().ToUpper(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'"); string userEmail = WebTools.GetExpr("EMAIL", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'"); DataSourceSelectArguments args = new DataSourceSelectArguments(); dv = MailDataSource.Select(args) as DataView; dt = dv.ToTable() as DataTable; string TRANSF_ID = IssueGridView.SelectedValue.ToString(); trans_no = WebTools.GetExpr("TRANSF_NO", "VIEW_ADAPTER_MAT_TRANSF", " WHERE TRANSF_ID='" + TRANSF_ID + "'"); B_STORE_ID = WebTools.GetExpr("B_STORE_ID", "VIEW_ADAPTER_MAT_TRANSF", " WHERE TRANSF_ID='" + TRANSF_ID + "'"); B_STORE = WebTools.GetExpr("B_STORE", "VIEW_ADAPTER_MAT_TRANSF", " WHERE TRANSF_ID='" + TRANSF_ID + "'"); string STATUS_FLG = WebTools.GetExpr("STATUS_FLG", "PIP_MAT_TRANSF", " WHERE TRANSF_ID='" + TRANSF_ID + "'"); if (STATUS_FLG == "N") { foreach (DataRow myRow in dt.Rows) { emailID = WebTools.GetExpr("EMAIL", "USERS_PDF_MAIL_LIST", " WHERE USER_NAME='" + myRow["USER_NAME"] + "' AND STORE_ID ='" + B_STORE_ID + "' AND UPPER(MODULE_NAME) ='MATERIAL TRANSFER'"); if (emailID != "") { string str = AmoghPdfMail.SendEmail(emailID, trans_no, uname, userEmail, type_id); } } string query = "UPDATE PIP_MAT_TRANSF SET STATUS_FLG ='Y' WHERE TRANSF_ID =" + TRANSF_ID; WebTools.ExeSql(query); Master.ShowSuccess("Email Sent To : " + B_STORE + " Users"); } else { Master.ShowWarn("Status Already Updated"); } } catch (Exception ex) { Master.ShowMessage(ex.Message); } }
protected void btnSendMail_Click(object sender, EventArgs e) { try { DataView dv; DataTable dt; string emailID; string mr_no; string type_id = "1"; string uname = Session["USER_NAME"].ToString().ToUpper(); string user_id = WebTools.GetExpr("USER_ID", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'"); string userEmail = WebTools.GetExpr("EMAIL", "USERS", " WHERE UPPER(USER_NAME)='" + uname + "'"); DataSourceSelectArguments args = new DataSourceSelectArguments(); dv = MailDataSource.Select(args) as DataView; dt = dv.ToTable() as DataTable; string mr_id = RadGrid1.SelectedValue.ToString(); mr_no = WebTools.GetExpr("MAT_REQ_NO", "MATERIAL_REQUEST", " WHERE MAT_REQ_ID='" + mr_id + "'"); string STATUS_FLG = WebTools.GetExpr("STATUS_FLG", "MATERIAL_REQUEST", " WHERE MAT_REQ_ID='" + mr_id + "'"); if (STATUS_FLG == "N") { foreach (DataRow myRow in dt.Rows) { emailID = WebTools.GetExpr("EMAIL", "USERS_PDF_MAIL_LIST", " WHERE USER_NAME='" + myRow["USER_NAME"] + "' AND UPPER(MODULE_NAME) ='MATERIAL REQUEST'"); if (emailID != "") { string str = AmoghPdfMail.SendEmail(emailID, mr_no, uname, userEmail, type_id); } } string query = "UPDATE MATERIAL_REQUEST SET STATUS_FLG ='Y' WHERE MAT_REQ_ID =" + mr_id; WebTools.ExeSql(query); Master.ShowSuccess("Email Sent To : WAREHOUSE CENTRE users:"); } else { Master.ShowWarn("Status Already Updated "); } } catch (Exception ex) { Master.ShowMessage(ex.Message); } }