Example #1
0
        protected void btnPrintPUN_Click(object sender, EventArgs e)
        {
            List <PickupNoticeModel> names = new List <PickupNoticeModel>();
            string punIds     = string.Empty;
            int    WeightInKg = 0;

            foreach (GridViewRow gvr in this.gvSearchPickupNotice.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    PickupNoticeModel g = new PickupNoticeModel();
                    if (!string.IsNullOrEmpty(punIds))
                    {
                        punIds += ",";
                    }
                    punIds += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString();
                    g.ID    = new Guid(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString());
                    names.Add(g);
                    WeightInKg = WeightInKg + Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WeightInKg"]);
                }
            }


            List <PickupNoticeModel> pikListcheck = PickupNoticeModel.PrintPUNChecking(punIds);

            if (pikListcheck.Count > 0)
            {
                Session["ReportType"] = "DoNuthing";
                Messages.SetMessage("You may contact system administrator for assistance. From selected PUN list the following WHR# are already printed: " + pikListcheck.Select(s => s.WarehouseReceiptNo.ToString()).Aggregate((str, nex) => str + "," + nex), Messages.MessageType.Warning);
            }
            else
            {
                List <PickupNoticeModel> pikList = PickupNoticeModel.PreparePUNId(punIds);
                if (pikList.Count > 0)
                {
                    Session["ReportType"] = "PUN";
                    Session["PUNID"]      = pikList.Select(s => s.ID.ToString()).Aggregate((str, nex) => str + "," + nex);
                    ScriptManager.RegisterStartupScript(this,
                                                        this.GetType(),
                                                        "ShowReport",
                                                        "<script type=\"text/javascript\">" +
                                                        string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                        "</script>",
                                                        false);
                }
                else
                {
                    Messages.SetMessage("The system can’t print this Pun please contact Administrator ", Messages.MessageType.Warning);
                }
            }
            btnGINProcess.Style["visibility"] = "Visible";
            btnPrintPUN.Style["visibility"]   = "Visible";
            btnProcessPSA.Style["visibility"] = "Visible";
        }
Example #2
0
        protected void btnPrintPUN_Click(object sender, EventArgs e)
        {
            PickupNoticeModel        objWHR = new PickupNoticeModel();
            List <PickupNoticeModel> names = new List <PickupNoticeModel>();
            string punIds = string.Empty, WHRNo = string.Empty;

            int WeightInKg = 0;

            foreach (GridViewRow gvr in this.gvSearchPickupNotice.Rows)
            {
                if (((CheckBox)gvr.FindControl("chkSelect")).Checked == true)
                {
                    PickupNoticeModel g = new PickupNoticeModel();
                    if (!string.IsNullOrEmpty(punIds))
                    {
                        punIds += ",";
                        WHRNo  += ",";
                    }
                    punIds += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString();
                    WHRNo  += gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WarehouseReceiptNo"];
                    g.ID    = new Guid(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Value.ToString());
                    names.Add(g);
                    WeightInKg = WeightInKg + Convert.ToInt32(gvSearchPickupNotice.DataKeys[gvr.RowIndex].Values["WeightInKg"]);
                }
            }

            List <PickupNoticeModel> pikList = PickupNoticeModel.PreparePUNId(punIds);

            Session["ReportType"] = "PUN";
            Session["PUNID"]      = pikList.Select(s => s.ID.ToString()).Aggregate((str, nex) => str + "," + nex);
            ScriptManager.RegisterStartupScript(this,
                                                this.GetType(),
                                                "ShowReport",
                                                "<script type=\"text/javascript\">" +
                                                string.Format("javascript:window.open(\"ReportViewer.aspx\", \"_blank\",\"height=1000px,width=1000px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +

                                                "</script>",
                                                false);
            btnPrintPUN.Style["visibility"] = "Visible";
            objWHR.MWarehouseReceiptNo      = WHRNo;
            objWHR.CreatedBy = UserBLL.GetCurrentUser();
            objWHR.Remark    = txtRemark.Text;
            objWHR.SaveWHR();
        }