protected void btnSaveSendToSippliers_Click(object s, EventArgs e) { try { DataTable dtGridItems = new DataTable(); dtGridItems.Columns.Add("Supplier_code", typeof(string)); dtGridItems.Columns.Add("Port_id", typeof(int)); dtGridItems.Columns.Add("remark", typeof(string)); dtGridItems.Columns.Add("RFQType"); DataRow dr; foreach (GridViewRow gr in gvRFQList.Rows) { string Supp = ((UserControl_uc_SupplierList)gr.FindControl("uc_SupplierListRFQ")).SelectedValue; string port = ((UserControl_ctlPortList)gr.FindControl("ctlPortListRFQ")).SelectedValue; if (Supp != "0" && port != "0") { dr = dtGridItems.NewRow(); dr["Supplier_Code"] = Supp; dr["port_id"] = int.Parse(port); dr["remark"] = ((TextBox)gr.FindControl("txtRemark")).Text; dr["RFQType"] = Int32.Parse(((RadioButtonList)gr.FindControl("rbtnRfqType")).SelectedValue); dtGridItems.Rows.Add(dr); } } DataTable dtQtnIdret = BLL_PURC_CTP.Ins_Ctp_SendRFQ(Contract_ID, dtGridItems, Convert.ToInt32(Session["USERID"])); if (dtQtnIdret.Rows.Count > 0) { btnSaveSendToSippliers.Enabled = false; BLL_PURC_Purchase objPurc = new BLL_PURC_Purchase(); CTP_RFQ_Mail objmail = new CTP_RFQ_Mail(); //if exists, Insert the Web Quotation supplier code in the PMS_Lib_Quotation_User and lib user foreach (DataRow drsupp in dtGridItems.Rows) { objPurc.GetSupplierUserDetails(drsupp["Supplier_Code"].ToString(), "S"); } foreach (DataRow drqtn in dtQtnIdret.Rows) { objmail.SendMailToSupplier(Convert.ToInt32(drqtn["QUOTATION_ID"].ToString()), Convert.ToInt32(drqtn["RFQType"].ToString()), this.Page); } String msgretv = String.Format("window.open('','_self','');window.close()"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgMail", msgretv, true); } } catch (Exception ex) { lblErrormsg.Text = ex.Message; } }
protected void btnExportEcelRFQ_Click(object s, EventArgs e) { try { CTP_RFQ_Mail objmail = new CTP_RFQ_Mail(); objmail.SendMailToSupplier(Convert.ToInt32(((ImageButton)s).CommandArgument), 1, this.Page); } catch (Exception ex) { lblmsg.Text = ex.Message; } }