Exemplo n.º 1
0
    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;
        }
    }
Exemplo n.º 2
0
 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;
     }
 }
    protected void btnReworkToSupplier_Click(object sender, EventArgs e)
    {
        int sts = BLL_PURC_CTP.Update_Ctp_ReworkToSupplier(Convert.ToInt32(Session["USERID"].ToString()), Convert.ToInt32(Request.QueryString["Quotation_ID"]));

        if (sts > 0)
        {
            //BindFieldsAfterSave();
            string  ServerIPAdd    = ConfigurationManager.AppSettings["WebQuotSite"].ToString();
            DataSet dsSendMailInfo = BLL_PURC_CTP.Get_Ctp_Supplier_Mail(Convert.ToInt32(Request.QueryString["Quotation_ID"]));

            CTP_RFQ_Mail objmail = new CTP_RFQ_Mail(this);
            objmail.SendEmailToSupplier(dsSendMailInfo, dsSendMailInfo.Tables[0].Rows[0]["supplier_code"].ToString(), ServerIPAdd, "", true, "3", true);
            String msg = String.Format("window.open('','_self','');window.close();");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
        }
    }