public void loadData()
        {
            try
            {
                DataSet getDsVal = new DataSet();

                ProductDetail obj = new ProductDetail();
                obj.ProductDetailID = Convert.ToInt32(Request.QueryString["detaiiId"]);
                getDsVal            = ProductDetailBLL.GetProductDetailByDetailID(obj);

                if (getDsVal != null)
                {
                    txtQuantityUnit.Text           = getDsVal.Tables[0].Rows[0]["QuantityUnit"].ToString();
                    txtDiscount.Text               = getDsVal.Tables[0].Rows[0]["Discount"].ToString();
                    txtSalePrice.Text              = getDsVal.Tables[0].Rows[0]["SalePrice"].ToString();
                    txtDateExpired.Text            = getDsVal.Tables[0].Rows[0]["DateExpired"].ToString();
                    drpProductMaster.SelectedValue = getDsVal.Tables[0].Rows[0]["ProductID"].ToString();
                    txtCostPrice.Text              = getDsVal.Tables[0].Rows[0]["CostPrice"].ToString();
                    txtStatus.Text = getDsVal.Tables[0].Rows[0]["Status"].ToString();
                    DateCreated    = Convert.ToDateTime(getDsVal.Tables[0].Rows[0]["DateCreated"].ToString()).Date;
                    DateUpdated    = Convert.ToDateTime(getDsVal.Tables[0].Rows[0]["DateUpdated"].ToString()).Date;
                    DateExpired    = Convert.ToDateTime(getDsVal.Tables[0].Rows[0]["DateExpired"].ToString()).Date;
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        protected void gdvlistProductDetail_Sorting(object sender, GridViewSortEventArgs e)
        {
            DataView sortedView;
            string   sortingDirection = string.Empty;

            if (direction == SortDirection.Ascending)
            {
                direction        = SortDirection.Descending;
                sortingDirection = "Desc";
            }
            else
            {
                direction        = SortDirection.Ascending;
                sortingDirection = "Asc";
            }
            ProductDetail obj = new ProductDetail();

            obj.ProductMasterID = Convert.ToInt32(Request.QueryString["ProMasid"]);
            ds = ProductDetailBLL.GetProductDetailByID(obj);


            sortedView                      = new DataView(ds.Tables[0]);
            sortedView.Sort                 = e.SortExpression + " " + sortingDirection;
            Session["SortedView"]           = sortedView;
            gdvlistProductDetail.DataSource = sortedView;
            gdvlistProductDetail.DataBind();
        }
Example #3
0
        protected void gdvDetails_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            try
            {
                if (e.CommandName.Equals("UpdateDep"))
                {
                    Label   ID  = (Label)gdvDetails.Rows[gdvDetails.EditIndex].FindControl("lblProd_Id");
                    TextBox SP  = (TextBox)gdvDetails.Rows[gdvDetails.EditIndex].Cells[0].FindControl("txtSP");
                    TextBox Exp = (TextBox)gdvDetails.Rows[gdvDetails.EditIndex].FindControl("txtEXP");
                    TextBox CP  = (TextBox)gdvDetails.Rows[gdvDetails.EditIndex].FindControl("txtCP");

                    ProductDetail objdrp = new ProductDetail();
                    objdrp.ProductDetailID = int.Parse(ID.Text);
                    DateTime resDate;
                    if (DateTime.TryParse(Exp.Text, out resDate))
                    {
                        objdrp.DateExpired = resDate;
                    }
                    else
                    {
                        WebMessageBoxUtil.Show("Invalid input in Expiry Date field ");
                        gdvDetails.EditIndex = -1;
                        //BindGrid();
                        return;
                    }
                    float res;
                    if (float.TryParse(SP.Text, out res))
                    {
                        objdrp.SalePrice = res;
                        float res2;
                        if (float.TryParse(CP.Text, out res2))
                        {
                            objdrp.CostPrice   = res2;
                            objdrp.DateUpdated = DateTime.Now;
                            ProductDetailBLL sdBLL = new ProductDetailBLL();
                            sdBLL.Update(objdrp);
                        }
                        else
                        {
                            WebMessageBoxUtil.Show("Invalid input in Cost Price field ");
                        }
                    }
                    else
                    {
                        WebMessageBoxUtil.Show("Invalid input in Sale Price field ");
                    }
                }
            }
            catch (Exception exp) { }
            finally
            {
                gdvDetails.EditIndex = -1;
                BindGrid();
            }
        }
Example #4
0
 public void BindgdvlistProductDetail()
 {
     if (Request.QueryString["ProMasid"] != null)
     {
         ProductDetail obj = new ProductDetail();
         obj.ProductMasterID = Convert.ToInt32(Request.QueryString["ProMasid"]);
         ds = ProductDetailBLL.GetProductDetailByID(obj);
         gdvlistProductDetail.DataSource = ds;
         gdvlistProductDetail.DataBind();
     }
 }
Example #5
0
        public void BindGrid()
        {
            DataSet ds = new DataSet();

            ProductDetail objdrp = new ProductDetail();

            currentId = int.Parse(Session["prod_ID"].ToString());
            objdrp.ProductMasterID = currentId;

            ds = ProductDetailBLL.GetProductDetailByID(objdrp);
            gdvDetails.DataSource = ds;
            gdvDetails.DataBind();
        }
Example #6
0
 protected void gdvDetails_RowDeleting(object sender, GridViewDeleteEventArgs e)
 {
     try
     {
         Label         ID     = (Label)gdvDetails.Rows[e.RowIndex].FindControl("lblProd_Id");
         ProductDetail objdrp = new ProductDetail();
         objdrp.ProductDetailID = int.Parse(ID.Text);
         ProductDetailBLL sdBLL = new ProductDetailBLL();
         sdBLL.Delete(objdrp);
     }
     catch (Exception exp) { }
     finally
     {
         gdvDetails.EditIndex = -1;
         BindGrid();
     }
 }
        protected void drpOrderDetail_SelectedIndexChanged(object sender, EventArgs e)
        {
            DropDownList  dpList = (DropDownList)sender;
            ProductDetail pd     = new ProductDetail();

            pd.ProductMasterID = int.Parse(dpList.SelectedValue);
            DataSet ds_temp = ProductDetailBLL.GetProductDetailByID(pd);


            // ds_temp.Tables[0].Columns
            //Label lbl = gdvOrderDetail.Rows[gdvOrderDetail.SelectedIndex].FindControl("lblCP") as Label;
            //lbl.Text = "1.0";

            //Label lbl_SP = gdvOrderDetail.Rows[gdvOrderDetail.SelectedIndex].FindControl("lblSP") as Label;
            //lbl_SP.Text = "1.2";

            Label lbl = gdvOrderDetail.Rows[gdvOrderDetail.EditIndex].FindControl("lblSP") as Label;

            lbl.Text = "3.2";

            Label lbl1 = gdvOrderDetail.Rows[gdvOrderDetail.EditIndex].FindControl("lblCP") as Label;

            lbl1.Text = "2.2";
        }