protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            if (!IsPostBack)
            {
                Master.ClearSessions();//Clear all sessions
                POSearchParameters searchPO = new POSearchParameters();
                searchPO.FromDateRep = null;
                searchPO.ToDateRep = null;

                Session["PurchaseItemReport"] = searchPO.SearchPOItemsForReporting();
                dxgvPurchaseByItems.DataSource = (DataSet)Session["PurchaseItemReport"];
                dxgvPurchaseByItems.DataBind();
            }

            if (IsCallback)
            {
                dxgvPurchaseByItems.DataSource = (DataSet)Session["PurchaseItemReport"];
                dxgvPurchaseByItems.DataBind();
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void Page_Load(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }
    /// <summary>
    /// Date range search button click
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            POSearchParameters searchPO = new POSearchParameters();
            searchPO.FromDateRep = dtpFromDate.Date;
            searchPO.ToDateRep = dtpToDate.Date;

            if (searchPO.ToDateRep < searchPO.FromDateRep)
            {
                return;
            }

            Session["PurchaseItemReport"] = null;
            Session["PurchaseItemReport"] = searchPO.SearchPOItemsForReporting();

            dxgvPurchaseByItems.DataSource = (DataSet)Session["PurchaseItemReport"];
            dxgvPurchaseByItems.DataBind();
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnSearch_Click(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }
Ejemplo n.º 3
0
        public DataSet GetItemwisePODetailsForReporting(POSearchParameters poSearch)
        {
            try
            {
                Database  db        = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand dbCommand = db.GetStoredProcCommand(Constant.SP_PO_Report_GetPODetailsByItems);

                db.AddInParameter(dbCommand, "@dFromDate", DbType.DateTime, poSearch.FromDateRep);
                db.AddInParameter(dbCommand, "@dToDate", DbType.DateTime, poSearch.ToDateRep);

                return(db.ExecuteDataSet(dbCommand));
            }
            catch (System.Exception ex)
            {
                ex.Data.Add("BusinessLayerException", GetType().ToString() + Constant.Error_Seperator + "public DataSet GetItemwisePODetailsForReporting(POSearchParameters poSearch)");
                return(null);

                throw ex;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Get PO Details for reporting
        /// </summary>
        /// <param name="poSearchParameters">Po search Parameters class object</param>
        /// <returns>DataSet</returns>
        public DataSet GetPurchaseOrdersForReporting(POSearchParameters poSearchParameters)
        {
            try
            {
                Database  db  = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand cmd = db.GetStoredProcCommand(Constant.SP_PO_Report_SearchPO);

                db.AddInParameter(cmd, "@iDueAmountOption", DbType.Int32, poSearchParameters.DueAmountOption);
                db.AddInParameter(cmd, "@iTotRcvdOption", DbType.Int32, poSearchParameters.TotRcvdOption);
                db.AddInParameter(cmd, "@sFromDate", DbType.String, poSearchParameters.FromDate);
                db.AddInParameter(cmd, "@sToDate", DbType.String, poSearchParameters.ToDate);

                return(db.ExecuteDataSet(cmd));
            }
            catch (System.Exception ex)
            {
                throw ex;
                return(null);
            }
        }
Ejemplo n.º 5
0
    protected void btnSearch_Click(object sender, EventArgs e)
    {
        try
        {
            POSearchParameters pos = new POSearchParameters();
            pos.POCode = txtPOCode.Text.Trim();
            pos.DueAmountOption = Int32.Parse(ddlPaymentDue.SelectedValue.Trim());
            pos.POAmount = Decimal.Parse(txtPOAmmount.Text.Trim() != String.Empty ? txtPOAmmount.Text.Trim() : "0");
            pos.SupId = Int32.Parse(ddlSupplier.SelectedValue.Trim());
            pos.TotRcvdOption = Int32.Parse(ddlPORecievedOption.SelectedValue.Trim());
            pos.FromDate = dtpFromDate.Value == null ? String.Empty : DateTime.Parse(dtpFromDate.Value.ToString()).ToShortDateString();
            pos.ToDate = dtpToDate.Value == null ? String.Empty : DateTime.Parse(dtpToDate.Value.ToString()).ToShortDateString();
            DataSet dsPOs = (new PODAO()).SearchPO(pos);
            Session["SearchPO"] = dsPOs;

            if (dsPOs != null && dsPOs.Tables[0].Rows.Count > 0)
            {
                dxgvPOSearch.DataSource = dsPOs;
                dxgvPOSearch.DataBind();
            }
            else
            {
                dxgvPOSearch.DataSource = dsPOs;
                dxgvPOSearch.DataBind();
            }
        }
        catch (Exception ex)
        {
            ex.Data.Add("UILayerException", this.GetType().ToString() + Constant.Error_Seperator + "protected void btnSearch_Click(object sender, EventArgs e)");
            if (Master.LoggedUser != null && Master.LoggedUser.UserName != null && Master.LoggedUser.UserName != string.Empty)
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, Master.LoggedUser.UserName), false);
            }
            else
            {
                Response.Redirect("Error.aspx?LogId=" + LankaTilesExceptions.WriteEventLogs(ex, Constant.Database_Connection_Name, "Annonimous"), false);
            }
        }
    }
Ejemplo n.º 6
0
        public DataSet SearchPO(POSearchParameters poSearchParameters)
        {
            try
            {
                Database  db  = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand cmd = db.GetStoredProcCommand(Constant.SP_PO_SearchPO);

                db.AddInParameter(cmd, "@sPOCode", DbType.String, poSearchParameters.POCode);
                db.AddInParameter(cmd, "@iSupId", DbType.Int32, poSearchParameters.SupId);
                db.AddInParameter(cmd, "@mPOAmount", DbType.Currency, poSearchParameters.POAmount);
                db.AddInParameter(cmd, "@iDueAmountOption", DbType.Int32, poSearchParameters.DueAmountOption);
                db.AddInParameter(cmd, "@iTotRcvdOption", DbType.Int32, poSearchParameters.TotRcvdOption);
                db.AddInParameter(cmd, "@sFromDate", DbType.String, poSearchParameters.FromDate);
                db.AddInParameter(cmd, "@sToDate", DbType.String, poSearchParameters.ToDate);

                return(db.ExecuteDataSet(cmd));
            }
            catch (System.Exception ex)
            {
                throw ex;
                return(null);
            }
        }
Ejemplo n.º 7
0
        public DataSet SearchPO(POSearchParameters poSearchParameters)
        {
            try
            {
                Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand cmd = db.GetStoredProcCommand(Constant.SP_PO_SearchPO);

                db.AddInParameter(cmd, "@sPOCode", DbType.String, poSearchParameters.POCode);
                db.AddInParameter(cmd, "@iSupId", DbType.Int32, poSearchParameters.SupId);
                db.AddInParameter(cmd, "@mPOAmount", DbType.Currency, poSearchParameters.POAmount);
                db.AddInParameter(cmd, "@iDueAmountOption", DbType.Int32, poSearchParameters.DueAmountOption);
                db.AddInParameter(cmd, "@iTotRcvdOption", DbType.Int32, poSearchParameters.TotRcvdOption);
                db.AddInParameter(cmd, "@sFromDate", DbType.String, poSearchParameters.FromDate);
                db.AddInParameter(cmd, "@sToDate", DbType.String, poSearchParameters.ToDate);

                return db.ExecuteDataSet(cmd);

            }
            catch (System.Exception ex)
            {
                throw ex;
                return null;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Get PO Details for reporting
        /// </summary>
        /// <param name="poSearchParameters">Po search Parameters class object</param>
        /// <returns>DataSet</returns>
        public DataSet GetPurchaseOrdersForReporting(POSearchParameters poSearchParameters)
        {
            try
            {
                Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand cmd = db.GetStoredProcCommand(Constant.SP_PO_Report_SearchPO);

                db.AddInParameter(cmd, "@iDueAmountOption", DbType.Int32, poSearchParameters.DueAmountOption);
                db.AddInParameter(cmd, "@iTotRcvdOption", DbType.Int32, poSearchParameters.TotRcvdOption);
                db.AddInParameter(cmd, "@sFromDate", DbType.String, poSearchParameters.FromDate);
                db.AddInParameter(cmd, "@sToDate", DbType.String, poSearchParameters.ToDate);

                return db.ExecuteDataSet(cmd);

            }
            catch (System.Exception ex)
            {
                throw ex;
                return null;
            }
        }
Ejemplo n.º 9
0
        public DataSet GetItemwisePODetailsForReporting(POSearchParameters poSearch)
        {
            try
            {
                Database db = DatabaseFactory.CreateDatabase(Constant.Database_Connection_Name);
                DbCommand dbCommand = db.GetStoredProcCommand(Constant.SP_PO_Report_GetPODetailsByItems);

                db.AddInParameter(dbCommand, "@dFromDate", DbType.DateTime, poSearch.FromDateRep);
                db.AddInParameter(dbCommand, "@dToDate", DbType.DateTime, poSearch.ToDateRep);

                return db.ExecuteDataSet(dbCommand);

            }
            catch (System.Exception ex)
            {
                ex.Data.Add("BusinessLayerException", GetType().ToString() + Constant.Error_Seperator + "public DataSet GetItemwisePODetailsForReporting(POSearchParameters poSearch)");
                return null;
                throw ex;
            }
        }