Esempio n. 1
0
        public static List <PreArrival> GetArrivalList()
        {
            System.Data.DataTable dt = new System.Data.DataTable();
            ECX.DataAccess.SQLHelper.PopulateTable("", dt, "");
            List <PreArrival> lst = new List <PreArrival>();

            foreach (System.Data.DataRow dr in dt.Rows)
            {
                PreArrival a = new PreArrival();
                ECX.DataAccess.Common.DataRow2Object(dr, a);
                lst.Add(a);
            }
            return(lst);
        }
Esempio n. 2
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Guid ClientId;

            try
            {
                ClientId = new Guid(this.ClientSelector1.ClientGUID.Value.ToString());
                if (ClientId == Guid.Empty || ClientId == null)
                {
                    Messages.SetMessage("Please enter Client ID.", WarehouseApplication.Messages.MessageType.Warning);
                    return;
                }
            }
            catch
            {
                Messages.SetMessage("Please enter Client ID.", WarehouseApplication.Messages.MessageType.Warning);
                return;
            }

            try
            {
                ValidateInputs();
                BLL.PreArrival objPreArrival = new BLL.PreArrival();
                objPreArrival.ClientId           = ClientId;
                objPreArrival.ClientName         = this.ClientSelector1.lblMessage.Text.Replace(']', ' ').Replace('[', ' ').Trim();
                objPreArrival.HasVoucher         = chkHasVoucher.Checked;
                objPreArrival.VoucherNumber      = txtVoucherNo.Text.Trim();
                objPreArrival.TruckPlateNumber   = txtTruckPlateNo.Text.Trim();
                objPreArrival.TrailerPlateNumber = txtTrailerPlateNo.Text.Trim();
                objPreArrival.CodeType           = "GRN";

                objPreArrival.WorkflowTypeID       = 1;
                objPreArrival.WarehouseID          = new Guid(HttpContext.Current.Session["CurrentWarehouse"].ToString());
                objPreArrival.UserID               = UserBLL.GetCurrentUser();
                objPreArrival.CompleteCodeToReturn = "";
                objPreArrival.IsTruckInCompound    = chkIsTruckInCompound.Checked;

                objPreArrival.Save();
                //lblMessage.ForeColor = System.Drawing.Color.Green;
                //lblMessage.Text = "Pre-Arrival registered successfully!";
                Messages.SetMessage("Pre-arrival record saved successfully.", WarehouseApplication.Messages.MessageType.Success);
                Clear();
                btnNext.Enabled   = true;
                btnNext.BackColor = System.Drawing.ColorTranslator.FromHtml("#88AB2D");

                Nullable <Guid> Id;
                Id = objPreArrival.ArrivalId;
                if (Id != null)
                {
                    Session["CommodityRequestId"] = Id;
                    Session["ReportType"]         = "PreArrival";
                    ScriptManager.RegisterStartupScript(this,
                                                        this.GetType(),
                                                        "ShowReport",
                                                        "<script type=\"text/javascript\">" +
                                                        string.Format("javascript:window.open(\"ReportViewer.aspx?id={0}\", \"_blank\",\"height=400px,width=600px,top=0,left=0,resizable=yes,scrollbars=yes\");", Guid.NewGuid()) +
                                                        "</script>",
                                                        false);
                }
            }
            catch (Exception ex)
            {
                //lblMessage.ForeColor = System.Drawing.Color.Tomato;
                //lblMessage.Text = "Failed to proceed, " + ex.Message.ToString();
                Messages.SetMessage("Unexpected error.  Please try again.", WarehouseApplication.Messages.MessageType.Error);
            }
        }
Esempio n. 3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // DataTable dt = new DataTable();
            ActiveReport rpt = null;

            if (Session["ReportType"].ToString() == "PreArrival")
            {
                BLL.PreArrival objPreArrival = new BLL.PreArrival();
                DataTable      dt            = objPreArrival.PopulatePreArrival(new Guid(Session["CommodityRequestId"].ToString()));
                rpt                           = new rptTrackingReport();
                rpt.DataSource                = dt;
                WebViewer1.Report             = rpt;
                Session["CommodityRequestId"] = null;
                WebViewer1.Width              = 600;
                WebViewer1.Height             = 400;
            }
            if (Session["ReportType"].ToString() == "GRN")
            {
                rpt = new rptGRNnew();
                GRN_BL    objGrnBl = new GRN_BL();
                DataTable dt       = objGrnBl.GetGRNReport(new Guid(Session["GRNId_GRN"].ToString()));
                rpt.DataSource    = dt;
                WebViewer1.Report = rpt;
            }
            if (Session["ReportType"].ToString() != "DoNuthing")
            {
                if (Session["ReportType"].ToString() == "PUN")
                {
                    rpt            = new rptPUNReport();
                    rpt.DataSource = GINBussiness.PickupNoticeModel.PrintPUN(Session["PUNID"].ToString());
                }
                else if (Session["ReportType"].ToString() == "GIN")
                {
                    rpt = new rptGINReport();
                    Session["GINID"] = ((GINModel)Session["GINMODEL"]).ID;
                    rpt.DataSource   = GINBussiness.PickupNoticeModel.PrintGIN(Convert.ToBoolean(Session["EditModePrint"]), new Guid(Session["GINID"].ToString()));
                }
                else if (Session["ReportType"].ToString() == "PSA")
                {
//----------Updated START ------ NOV 27 2013

                    // if it is redirected from search page
                    string statusx = "Unapproved PSA";
                    if (Request.QueryString["GINID"] == null)
                    {
                        rpt = new rptPSAReport(statusx);
                        Session["GINPSAID"] = ((GINModel)Session["GINMODEL"]).ID;
                        rpt.DataSource      = GINBussiness.PickupNoticeModel.PrintPSA(new Guid(Session["GINPSAID"].ToString()));
                    }
                    else
                    {
                        statusx = (Convert.ToInt16(Request.QueryString["ST"]) % 11 == 0) ? "Approved" : "Unapproved PSA";
                        rpt     = new rptPSAReport(statusx);
                        if (statusx.Equals("Approved"))
                        {
                            rpt.DataSource = GINBussiness.PickupNoticeModel.PrintPSA_Approved(new Guid(Request.QueryString["GINID"]));
                        }
                        else
                        {
                            rpt.DataSource = GINBussiness.PickupNoticeModel.PrintPSA(new Guid(Request.QueryString["GINID"]));
                        }
                    }
//----------Updated End ------ NOV 27 2013
                }
                else if (Session["ReportType"].ToString() == "ExpierdList")
                {
                    rpt = new rptPickupNoticeExpiredList();
                    DataTable dt = new DataTable();
                    dt = PickupNoticeModel.SearchExpieredList(UserBLL.GetCurrentWarehouse(), Convert.ToDateTime(Session["ExpirationDateFrom"]), Convert.ToDateTime(Session["ExpirationDateTo"]));
                    if (dt.Rows.Count > 0)
                    {
                        rpt.DataSource = dt;
                    }
                    else
                    {
                        return;
                    }
                }
                else if (Session["ReportType"].ToString() == "ExpierdListAdmin")
                {
                    rpt = new rptPickupNoticeExpiredList();
                    DataTable dt = new DataTable();
                    dt = PickupNoticeModel.SearchExpieredListAdmin(Convert.ToDateTime(Session["ExpirationDateFrom"]), Convert.ToDateTime(Session["ExpirationDateTo"]));
                    if (dt.Rows.Count > 0)
                    {
                        rpt.DataSource = dt;
                    }
                    else
                    {
                        return;
                    }
                }
                else if (Session["ReportType"].ToString() == "GINApproval")
                {
                    rpt                          = new rptGINApproval();
                    rpt.DataSource               = GINBussiness.GINModel.PrintGINApprovalReport(UserBLL.GetCurrentWarehouse(), new Guid(Session["SelectedLIC"].ToString()));
                    WebViewer1.Report            = rpt;
                    rpt.PageSettings.Margins.Top = 0;
                }
                else if (Session["ReportType"].ToString() == "SampleTicket")
                {
                    //rpt = new rptSampleTicketCoffeeNew();
                    //rpt.DataSource = SamplingBussiness.SamplingModel.GetSampleTicketReport(new Guid(Session["SampleId"].ToString()));

                    rpt            = new rptSampleTicketCoffeeNew();
                    rpt.DataSource = SamplingBussiness.SamplingModel.GetSampleTicketReport(new Guid(Session["SampleId"].ToString()));
                }
                else if (Session["ReportType"].ToString() == "GradingResult")
                {
                    rpt = new rptResultReport();

                    rpt.DataSource = GradingModel.GradingResultreport(Session["GradingCode"].ToString());
                }
                else if (Session["ReportType"].ToString() == "GradingResultNoDeposit")
                {
                    rpt = new rptInspectionTestResult();

                    rpt.DataSource = GradingModel.GetInspectionTestResult(Session["GradingCode"].ToString(), UserBLL.GetCurrentWarehouse());
                }
                else if (Session["ReportType"].ToString() == "GradingCode")
                {
                    rpt = new rptGenerate();
                    DataTable dt = new DataTable();
                    dt = GradingModel.printCode(new Guid(Session["GenerateCode"].ToString()), new Guid(Session["VoucherCommodityTypeID"].ToString()), new Guid(Session["CommodityID"].ToString()));

                    rpt.DataSource = dt;
                }
                else if (Session["ReportType"].ToString() == "GradingResultForSegrigation")
                {
                    rpt            = new Report.rptSegrigationGradingReport();
                    rpt.DataSource = GradingModel.GradingResultreportForSegrigation(Session["GradingCode"].ToString());
                }
                if (Session["ReportType"].ToString() != "GINApproval")
                {
                    rpt.PageSettings.Margins.Top   = 0;
                    rpt.PageSettings.Margins.Left  = 0.4f;
                    rpt.PageSettings.Margins.Right = 0.4f;
                    WebViewer1.Report = rpt;

                    //rpt.Run(false);
                    //Response.ContentType = "application/pdf";
                    //Response.AddHeader("content-disposition", "inline; filename=MyPDF.PDF");

                    //// Create the PDF export object
                    //PdfExport pdf = new PdfExport();
                    //// Create a new memory stream that will hold the pdf output
                    //System.IO.MemoryStream memStream = new System.IO.MemoryStream();
                    //// Export the report to PDF:
                    //pdf.Export(rpt.Document, memStream);
                    //// Write the PDF stream out
                    //Response.BinaryWrite(memStream.ToArray());
                    //// Send all buffered content to the client
                    //Response.End();
                }
            }
        }