Ejemplo n.º 1
0
    //protected void GrdViewItems_SelectedIndexChanged(object sender, EventArgs e)
    //{


    //}


    //protected void GrdViewPurchase_RowDeleting(object sender, GridViewDeleteEventArgs e)
    //{

    //}

    protected void lnkBtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            ModalPopupLock.Show();
            DataSet ds = new DataSet();

            string connection = string.Empty;
            string userid     = string.Empty;

            if (Request.Cookies["Company"] != null)
            {
                connection = Request.Cookies["Company"].Value;
            }

            if (Request.QueryString["ID"] != null)
            {
                userid = Request.QueryString["ID"].ToString();
            }

            BusinessLogic objBus = new BusinessLogic();

            ds = objBus.GetMasterRoles(System.Configuration.ConfigurationManager.ConnectionStrings[connection].ConnectionString);

            GrdViewItems.DataSource = ds;
            GrdViewItems.DataBind();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Ejemplo n.º 2
0
    protected void GrdViewItems_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        try
        {
            //bindGrid();

            GrdViewItems.PageIndex = e.NewPageIndex;
            GrdViewItems.DataBind();
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Ejemplo n.º 3
0
    protected void cmdCancel_Click(object sender, EventArgs e)
    {
        try
        {
            GrdViewItems.DataSource = null;
            GrdViewItems.DataBind();

            ModalPopupLock.Hide();

            BusinessLogic objChk     = new BusinessLogic();
            string        dbfileName = sDataSource.Remove(0, sDataSource.LastIndexOf(@"App_Data\") + 9);
            dbfileName = dbfileName.Remove(dbfileName.LastIndexOf(";Persist Security Info"));

            if (objChk.CheckForOffline(Server.MapPath("Offline\\" + dbfileName + ".offline")))
            {
                lnkBtnAdd.Visible = false;
                pnlSearch.Visible = false;
            }
        }
        catch (Exception ex)
        {
            TroyLiteExceptionManager.HandleException(ex);
        }
    }
Ejemplo n.º 4
0
    public void GetProductsStock()
    {
        sDataSource = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString();
        ReportsBL.ReportClass report = new ReportsBL.ReportClass();
        DataSet ds = new DataSet();

        ds = report.getProductStockVerify(sDataSource);
        string     strItemCode = string.Empty;
        DataColumn dcArr;
        double     salesQty    = 0;
        double     purchaseQty = 0;
        double     InQty       = 0;
        double     OutQty      = 0;
        double     arrQty      = 0;
        double     accQty      = 0;
        double     opStock     = 0;

        dcArr = new DataColumn("ArrStock");
        ds.Tables[0].Columns.Add(dcArr);
        if (ds != null)
        {
            if (ds.Tables[0] != null)
            {
                foreach (DataRow dr in ds.Tables[0].Rows)
                {
                    if (dr["itemCode"] != null)
                    {
                        strItemCode    = dr["itemCode"].ToString();
                        accQty         = Convert.ToDouble(dr["Stock"]);
                        opStock        = report.getOpeningStock(sDataSource, strItemCode, "");
                        salesQty       = report.getStockSales(sDataSource, strItemCode, DateTime.Now, "");
                        purchaseQty    = report.getStockPurchase(sDataSource, strItemCode, DateTime.Now, "");
                        InQty          = report.getStockIN(sDataSource, strItemCode, DateTime.Now);
                        OutQty         = report.getStockOUT(sDataSource, strItemCode, DateTime.Now);
                        arrQty         = opStock + (purchaseQty - salesQty) + (OutQty - InQty);
                        dr["ArrStock"] = arrQty.ToString();
                    }
                }
            }
        }

        GrdViewItems.DataSource = ds;
        GrdViewItems.DataBind();
        GrdViewItems.Visible = false;

        #region Export To Excel
        if (ds.Tables[0].Rows.Count > 0)
        {
            DataTable dt = new DataTable();
            dt.Columns.Add(new DataColumn("Product Code"));
            dt.Columns.Add(new DataColumn("Product Name"));
            dt.Columns.Add(new DataColumn("Stock In Hand"));
            dt.Columns.Add(new DataColumn("Arrived Stock"));

            foreach (DataRow dr in ds.Tables[0].Rows)
            {
                DataRow dr_export = dt.NewRow();
                dr_export["Product Code"]  = dr["ItemCode"];
                dr_export["Product Name"]  = dr["Product"];
                dr_export["Stock In Hand"] = dr["Stock"];
                dr_export["Arrived Stock"] = dr["ArrStock"];
                dt.Rows.Add(dr_export);
            }

            DataRow dr_lastexport = dt.NewRow();
            dr_lastexport["Product Code"]  = "";
            dr_lastexport["Product Name"]  = "";
            dr_lastexport["Stock In Hand"] = "";
            dr_lastexport["Arrived Stock"] = "";
            ExportToExcel("Stock Verification Report.xls", dt);
        }
        #endregion
    }