示例#1
0
    public DataTable InsertCostingSMV(CostingSmv smv, DataTable data)
    {
        DataTable dt = null;

        try
        {
            OpenConnection();
            ArrayList arlSqlParameter = new ArrayList();
            arlSqlParameter.Add(new SqlParameter("@BuyerId", smv.BuyerId));
            arlSqlParameter.Add(new SqlParameter("@SampleStageId", smv.SampleStageId));
            arlSqlParameter.Add(new SqlParameter("@StyleNumber", smv.StyleNumber));
            arlSqlParameter.Add(new SqlParameter("@DesignNumber", smv.DesignNumber));
            arlSqlParameter.Add(new SqlParameter("@StyleDescription", smv.StyleDescription));
            arlSqlParameter.Add(new SqlParameter("@FabricId", smv.FabricId));
            arlSqlParameter.Add(new SqlParameter("@DepartmentName", smv.Department));
            arlSqlParameter.Add(new SqlParameter("@SwingSmv", smv.SewingSmv));
            arlSqlParameter.Add(new SqlParameter("@PleatingSmv", smv.PleatingSmv));

            arlSqlParameter.Add(new SqlParameter("@PermanentCrease", smv.PermanentCrease));
            arlSqlParameter.Add(new SqlParameter("@SupperCrease", smv.SupperCrease));

            arlSqlParameter.Add(new SqlParameter("@HeatSealHeatSmv", smv.HeatSeal));
            arlSqlParameter.Add(new SqlParameter("@OverlayFilmHeatSmv", smv.OverlayFilm));
            arlSqlParameter.Add(new SqlParameter("@PLKQuiltingSmv", smv.PLKQuilting));
            arlSqlParameter.Add(new SqlParameter("@AutoQuiltingSmv", smv.AutoQuilting));
            arlSqlParameter.Add(new SqlParameter("@ManualQuiltingSmv", smv.ManualQuilting));
            arlSqlParameter.Add(new SqlParameter("@ManualDownFill", smv.ManualDownFill));
            arlSqlParameter.Add(new SqlParameter("@MachineDownFill", smv.MachineDownFill));
            arlSqlParameter.Add(new SqlParameter("@SeamSeal", smv.SeamSeal));
            arlSqlParameter.Add(new SqlParameter("@Bonding", smv.Bonding));
            arlSqlParameter.Add(new SqlParameter("@CuttingSMV", smv.CuttingSMV));
            arlSqlParameter.Add(new SqlParameter("@FinisingSmv", smv.FinishingSmv));
            arlSqlParameter.Add(new SqlParameter("@OtherValue", smv.OthersValue));
            arlSqlParameter.Add(new SqlParameter("@OthersDescription", smv.OthersDescription));

            arlSqlParameter.Add(new SqlParameter("@OptionValue", smv.OptionValue));
            arlSqlParameter.Add(new SqlParameter("@OptionDescription", smv.OptionDescription));
            arlSqlParameter.Add(new SqlParameter("@OptionNumber", smv.OptionNumber));
            arlSqlParameter.Add(new SqlParameter("@OptionRemarks", smv.OptionRemarks));
            arlSqlParameter.Add(new SqlParameter("@OptionAdditionalValue", smv.OptionAdditionalValue));

            //new for option
            arlSqlParameter.Add(new SqlParameter("@OptionData", data));
            //end

            arlSqlParameter.Add(new SqlParameter("@ReviewBy", smv.ReviewBy));
            arlSqlParameter.Add(new SqlParameter("@ApprovedBy", smv.ApprovedBy));
            arlSqlParameter.Add(new SqlParameter("@Remarks", smv.Remarks));
            arlSqlParameter.Add(new SqlParameter("@PostedBy", smv.PostedBy));
            arlSqlParameter.Add(new SqlParameter("@UpdatedBy", smv.UpdatedBy));

            arlSqlParameter.Add(new SqlParameter("@productCategoryId", smv.ProductCategory));
            arlSqlParameter.Add(new SqlParameter("@machineWork", smv.MachineDescription));
            arlSqlParameter.Add(new SqlParameter("@sampleDate", smv.SampleDate));
            arlSqlParameter.Add(new SqlParameter("@seasonId", smv.Season));


            dt = this.ExecuteQuery("[Kp].[Usp_InsertCostingSmvInfo]", arlSqlParameter);
        }
        catch (Exception ex)
        {
        }
        finally
        {
            CloseConnection();
        }
        return(dt);
    }
示例#2
0
    public void SendMailForCostingSmv(CostingSmv smv)
    {
        string       buyerName    = String.Empty;
        string       sampleStage  = String.Empty;
        string       postedByName = String.Empty;
        string       zoneName     = String.Empty;
        BuyerGateway buyerGateway = new BuyerGateway();
        DataTable    dt           = new DataTable();

        dt = buyerGateway.GetSendingMailInfo(smv.BuyerId, smv.SampleStageId, smv.PostedBy);
        if (dt.Rows.Count > 0)
        {
            buyerName    = dt.Rows[0]["BuyerName"].ToString();
            sampleStage  = dt.Rows[0]["SampleStage"].ToString();
            postedByName = dt.Rows[0]["PostedByName"].ToString();
            zoneName     = dt.Rows[0]["ZoneName"].ToString();
        }

        StringBuilder mailBody = new StringBuilder();

        mailBody.Append("Dear Concern,"
                        + " The new costing smv on Buyer Name : " + buyerName + ", Style number: " + smv.StyleNumber
                        + " Sample Stage : " + sampleStage + ", Season : " + smv.Season + "Sewing Smv:" + smv.SewingSmv
                        + " was stored by : " + postedByName

                        + "Thank You"
                        + "**NB:- Please do not reply this Email"
                        );


        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();


        //mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");

        //mail.To.Add("ismatkhanzarin @gmail.com");

        mail.From            = new MailAddress("*****@*****.**", "Smv System", System.Text.Encoding.UTF8);
        mail.Subject         = "New Smv For - Style:" + smv.StyleNumber;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body            = mailBody.ToString();
        mail.BodyEncoding    = System.Text.Encoding.UTF8;
        mail.IsBodyHtml      = true;
        mail.Priority        = MailPriority.High;
        SmtpClient client = new SmtpClient();

        client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "@2018Smv");
        client.Port        = 587;
        client.Host        = "smtp.gmail.com";
        client.EnableSsl   = true;
        try
        {
            client.Send(mail);
        }
        catch (Exception ex)
        {
            Exception ex2          = ex;
            string    errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2           = ex2.InnerException;
                throw ex2;
            }
        }
    }
示例#3
0
    public void SendMailForApprovedByNotSet(CostingSmv smv)
    {
        string       buyerName    = String.Empty;
        string       sampleStage  = String.Empty;
        string       postedByName = String.Empty;
        string       zoneName     = String.Empty;
        BuyerGateway buyerGateway = new BuyerGateway();
        DataTable    dt           = new DataTable();

        if (smv.UpdatedBy == 0)
        {
            dt = buyerGateway.GetSendingMailInfo(smv.BuyerId, smv.SampleStageId, smv.PostedBy);
        }
        else
        {
            dt = buyerGateway.GetSendingMailInfo(smv.BuyerId, smv.SampleStageId, smv.UpdatedBy);
        }


        if (dt.Rows.Count > 0)
        {
            buyerName    = dt.Rows[0]["BuyerName"].ToString();
            sampleStage  = dt.Rows[0]["SampleStage"].ToString();
            postedByName = dt.Rows[0]["PostedByName"].ToString();
            zoneName     = dt.Rows[0]["ZoneName"].ToString();
        }

        StringBuilder mailBody = new StringBuilder();

        mailBody.Append("<h3>Dear Concern,</h3>"
                        + "<br/>"
                        + " <p>"
                        + " The costing smv of Buyer Name : " + buyerName + ", <br/> Style number: " + smv.StyleNumber
                        + " <br/> Design number: " + smv.DesignNumber
                        + " <br/> Sample Stage : " + sampleStage + ", <br/> Season : " + smv.Season + ", <br/> Sewing Smv:" + smv.SewingSmv
                        + " <br/> was stored by : " + postedByName
                        + " <br/> Without Approved From: " + zoneName
                        + " </p>"
                        + "<br/>"
                        + " Thank You"
                        + "<br/>"
                        + "**NB:- Please do not reply this Email"
                        );


        System.Net.Mail.MailMessage mail = new System.Net.Mail.MailMessage();

        //mail.To.Add("*****@*****.**");
        //mail.To.Add("*****@*****.**");

        //if (zoneName == "CEPZ")
        //{
        //    mail.To.Add("*****@*****.**");

        //}
        //else if (zoneName == "KEPZ")
        //{
        //    mail.To.Add("*****@*****.**");

        //}
        //mail.To.Add("*****@*****.**");
        //mail.To.Add("*****@*****.**");
        mail.To.Add("*****@*****.**");

        mail.From            = new MailAddress("*****@*****.**", "No-Reply", System.Text.Encoding.UTF8);
        mail.Subject         = "Approval Missing For - Style:" + smv.StyleNumber;
        mail.SubjectEncoding = System.Text.Encoding.UTF8;
        mail.Body            = mailBody.ToString();
        mail.BodyEncoding    = System.Text.Encoding.UTF8;
        mail.IsBodyHtml      = true;
        mail.Priority        = MailPriority.High;
        SmtpClient client = new SmtpClient();

        //client.Credentials = new System.Net.NetworkCredential("*****@*****.**", "@2018Smv");
        client.Port = 25;
        client.Host = "mail.hirdaramani.com";
        //client.EnableSsl = true;
        try
        {
            //if (zoneName == "KEPZ" || zoneName == "CEPZ")
            //{
            client.Send(mail);
            //}
        }
        catch (Exception ex)
        {
            Exception ex2          = ex;
            string    errorMessage = string.Empty;
            while (ex2 != null)
            {
                errorMessage += ex2.ToString();
                ex2           = ex2.InnerException;
                throw ex2;
            }
        }
    }
    protected void updateButton_Click(object sender, EventArgs e)
    {
        string listOfOption = string.Empty;

        //if (Session["ListOfOption"].ToString() != "[]" || Session["ListOfOption"] != null)
        //{

        //    listOfOption = Session["ListOfOption"].ToString();

        //}

        try
        {
            if (Session["ListOfOption"].ToString() != "[]" || Session["ListOfOption"] != null)
            {
                listOfOption = Session["ListOfOption"].ToString();
            }
        }
        catch
        {
            listOfOption = "[]";
        }

        List <CostingOptionModel> dataList            = new List <CostingOptionModel>();
        List <CostingOptionModel> listOfCostingOption = JsonConvert.DeserializeObject <List <CostingOptionModel> >(listOfOption);

        foreach (var optionModel in listOfCostingOption)
        {
            CostingOptionModel costingOption = new CostingOptionModel();
            costingOption.OptionNumber = optionModel.OptionNumber;
            if (optionModel.OptionReduction == null || optionModel.OptionReduction == "")
            {
                costingOption.OptionReduction = "0.00";
            }
            else
            {
                costingOption.OptionReduction = optionModel.OptionReduction;
            }
            if (optionModel.OptionAddition == null || optionModel.OptionAddition == "")
            {
                costingOption.OptionAddition = "0.00";
            }
            else
            {
                costingOption.OptionAddition = optionModel.OptionAddition;
            }
            costingOption.OptionDescription = optionModel.OptionDescription;
            costingOption.OptionRemarks     = optionModel.OptionRemarks;
            dataList.Add(costingOption);
        }
        DataTable data = ToDataTable(dataList);
        DataTable dt   = new DataTable();

        try
        {
            if (UpId != 0)
            {
                int        value     = 0;
                CostingSmv smv       = new CostingSmv();
                SmvBLL     smvBLL    = new SmvBLL();
                MailClass  mailClass = new MailClass();
                smv.BuyerId = Convert.ToInt32(buyerNameDropDownList.SelectedValue);

                value                = Convert.ToInt32(sampleStageHiddenField.Value);
                smv.SampleStageId    = value;
                smv.StyleNumber      = styleNumberTextBox.Text.Trim();
                smv.DesignNumber     = designTextBox.Text.Trim();
                smv.StyleDescription = styleDescriptionTextBox.Text;
                smv.FabricId         = Convert.ToInt32(fabricDropDownList.SelectedValue);
                smv.ProductCategory  = Convert.ToInt32(ProductDropDownList.SelectedValue);
                //smv.SeasonId = Convert.ToInt32(SeasonDropDownList.SelectedValue);
                smv.Season     = seasonTextBox.Text.Trim();
                smv.Department = "";
                //smv.SampleDate = sampleDateTextBox.Text;
                if (sampleDateTextBox.Text == "1900-01-01")
                {
                    smv.SampleDate = Convert.ToString("");
                }
                else
                {
                    smv.SampleDate = Convert.ToString(sampleDateTextBox.Text);
                }


                if (sewingTextBox.Text == "" || sewingTextBox.Text == null)
                {
                    smv.SewingSmv = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.SewingSmv = Convert.ToDecimal(sewingTextBox.Text);
                }

                if (pleatingTextBox.Text == "" || pleatingTextBox.Text == null)
                {
                    smv.PleatingSmv = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.PleatingSmv = Convert.ToDecimal(pleatingTextBox.Text);
                }



                if (permanentCreaseTextBox.Text == "" || permanentCreaseTextBox.Text == null)
                {
                    smv.PermanentCrease = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.PermanentCrease = Convert.ToDecimal(permanentCreaseTextBox.Text);
                }

                if (supperCreaseTextBox.Text == "" || supperCreaseTextBox.Text == null)
                {
                    smv.SupperCrease = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.SupperCrease = Convert.ToDecimal(supperCreaseTextBox.Text);
                }



                if (heatSealTextBox.Text == "" || heatSealTextBox.Text == null)
                {
                    smv.HeatSeal = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.HeatSeal = Convert.ToDecimal(heatSealTextBox.Text);
                }

                if (overlayTextBox.Text == "" || overlayTextBox.Text == null)
                {
                    smv.OverlayFilm = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.OverlayFilm = Convert.ToDecimal(overlayTextBox.Text);
                }

                if (plkTextBox.Text == "" || plkTextBox.Text == null)
                {
                    smv.PLKQuilting = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.PLKQuilting = Convert.ToDecimal(plkTextBox.Text);
                }

                if (autoTextBox.Text == "" || autoTextBox.Text == null)
                {
                    smv.AutoQuilting = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.AutoQuilting = Convert.ToDecimal(autoTextBox.Text);
                }
                if (quiltingManualTextBox.Text == "" || quiltingManualTextBox.Text == null)
                {
                    smv.ManualQuilting = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.ManualQuilting = Convert.ToDecimal(quiltingManualTextBox.Text);
                }

                if (downManualTextBox.Text == "" || downManualTextBox.Text == null)
                {
                    smv.ManualDownFill = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.ManualDownFill = Convert.ToDecimal(downManualTextBox.Text);
                }

                if (downMachineTextBox.Text == "" || downMachineTextBox.Text == null)
                {
                    smv.MachineDownFill = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.MachineDownFill = Convert.ToDecimal(downMachineTextBox.Text);
                }

                if (seamTextBox.Text == "" || seamTextBox.Text == null)
                {
                    smv.SeamSeal = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.SeamSeal = Convert.ToDecimal(seamTextBox.Text);
                }

                if (bondingTextBox.Text == "" || bondingTextBox.Text == null)
                {
                    smv.Bonding = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.Bonding = Convert.ToDecimal(bondingTextBox.Text);
                }
                if (cuttingTextBox.Text == "" || cuttingTextBox.Text == null)
                {
                    smv.CuttingSMV = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.CuttingSMV = Convert.ToDecimal(cuttingTextBox.Text);
                }
                if (finisingTextBox.Text == "" || finisingTextBox.Text == null)
                {
                    smv.FinishingSmv = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.FinishingSmv = Convert.ToDecimal(finisingTextBox.Text);
                }

                if (otherValueTextBox.Text == "" || otherValueTextBox.Text == null)
                {
                    smv.OthersValue = Convert.ToDecimal("0.00");
                }
                else
                {
                    smv.OthersValue = Convert.ToDecimal(otherValueTextBox.Text);
                }


                smv.OthersDescription     = otherDescriptionTextBox.Text;
                smv.OptionValue           = Convert.ToDecimal("0.00");
                smv.OptionAdditionalValue = Convert.ToDecimal("0.00");
                smv.OptionNumber          = "";
                smv.OptionDescription     = "";
                smv.OptionRemarks         = "";
                smv.ReviewBy   = Convert.ToInt32(reviewDropDownList.SelectedValue);
                smv.ApprovedBy = Convert.ToInt32(approvedDropDownList.SelectedValue);

                smv.Remarks            = descriptionTextarea.InnerText;
                smv.MachineDescription = machineDetailsTextarea.InnerText;
                smv.SmvId     = UpId;
                smv.UpdatedBy = Convert.ToInt32(userId);
                actionResult  = smvBLL.UpdateCostingSmv(smv, data);

                if (actionResult >= 1)
                {
                    messageLabel.Text = "<p Style ='font-size:20px;color:Green; margin-top:20px;'> Information Successfully Updated</p>";
                    if (smv.ApprovedBy == 0)
                    {
                        mailClass.SendMailForApprovedByNotSet(smv);
                    }
                    ClearAllData();
                    Page.Response.Redirect(url.ToString(), true);
                }
                else
                {
                    messageLabel.Text = "<p Style ='font-size:20px;color:Red; margin-top:20px;'>Already Exists...</p>";
                }
            }
        }
        catch (Exception ex)
        {
        }
        table            = loadCostingSmvinformation(buyerId, styleNumber);
        mainBody.Visible = false;
    }