Exemplo n.º 1
0
 protected void IMGBTNcategoryisActive_Click(object sender, ImageClickEventArgs e)
 {
     ImageButton lnk = (ImageButton)sender;
     int userid = Convert.ToInt32(lnk.CommandArgument);
     objprodctg = null;
     objprodctg = ObjprodClass.GetProdOfferByID(userid);
     if (objprodctg != null)
     {
         if (objprodctg.IsActive == true)
             ChkIsActiveprodoffer.Checked = true;
         TXTprodOffer.Text = objprodctg.OfferPercent.ToString();
         errorpopheaderprodoffer.Style.Add("display", "none");
         DIVIsActive.Style.Add("display", "block");
         btnSubmitprodoffer.Text = "Update";
         ViewState["popupID"] = userid.ToString();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPprodofferUpdate('true');});", true);
     }
 }
Exemplo n.º 2
0
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        string categoryname = TXTprodOffer.Text;
        if (categoryname != null)
        {
            objprodctg.OfferPercent = Convert.ToDecimal(categoryname.ToString());
            objprodctg.CreatedDate = DateTime.Now;
            switch (btnSubmitprodoffer.Text.Trim())
            {
                case "Submit":
                    ViewState["popupID"] = null;
                    Status = ObjprodClass.insertProdOffer(objprodctg);
                    if (Status == "Information Insert successfully.")
                    {
                        errorpopheaderprodoffer.Visible = true;
                        errorpopheaderprodoffer.Style.Add("display", "block");
                        errorpopheaderprodoffer.Attributes.Add("class", "fk-msg-success");
                        errorpopheaderprodoffer.InnerHtml = "ProductType Inserted successfully";
                        BindProdCategoryGrid();
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPprodoffer('true');});", true);
                    }
                    else
                    {
                        errorpopheaderprodoffer.Visible = true;
                        errorpopheaderprodoffer.Style.Add("display", "block");
                        errorpopheaderprodoffer.Attributes.Add("class", "fk-err-all");
                        errorpopheaderprodoffer.InnerHtml = Status;
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPprodoffer('true');});", true);
                    }
                    break;
                case "Update":
                    if (ViewState["popupID"] != null && ViewState["popupID"] != "")
                    {
                        objprodctg = null;
                        objprodctg = ObjprodClass.GetProdOfferByID(Convert.ToInt32(ViewState["popupID"]));
                        objprodctg.OfferPercent = Convert.ToDecimal(categoryname.ToString());
                        if (ChkIsActiveprodoffer.Checked)
                            objprodctg.IsActive = true;
                        else
                            objprodctg.IsActive = false;
                        Status = ObjprodClass.UpdateProdOffer(objprodctg);
                        if (Status == "Information Update successfully.")
                        {
                            errorpopheaderprodoffer.Visible = true;
                            errorpopheaderprodoffer.Style.Add("display", "block");
                            errorpopheaderprodoffer.Attributes.Add("class", "fk-msg-success");
                            errorpopheaderprodoffer.InnerHtml = "ProductType Updated successfully";
                            BindProdCategoryGrid();
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPprodofferUpdate('true');});", true);
                        }
                        else
                        {
                            errorpopheaderprodoffer.Visible = true;
                            errorpopheaderprodoffer.Style.Add("display", "block");
                            errorpopheaderprodoffer.Attributes.Add("class", "fk-err-all");
                            errorpopheaderprodoffer.InnerHtml = Status;
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPprodofferUpdate('true');});", true);
                        }
                    }
                    break;
            }


        }
    }
Exemplo n.º 3
0
 public ProdOffer GetProdOfferByID(int id)
 {
     ObjProdOffer = null;
     ObjProdOffer = DataRepository.ProdOfferProvider.GetById(id);
     return ObjProdOffer;
 }
Exemplo n.º 4
0
    protected void grdprod_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow && e.Row.DataItem != null)
        {
            try
            {
                GridViewRow gr = e.Row;
                Label lblprodname = (Label)gr.FindControl("lblProdname");
                Label lblProdctg = (Label)gr.FindControl("lblProdctg");
                Label lblProdcomp = (Label)gr.FindControl("lblProdcomp");
                Label lblProdtype = (Label)gr.FindControl("lblProdtype");
                Label lblProdsupp = (Label)gr.FindControl("lblProdsupp");
                Label lblProdmedicinefor = (Label)gr.FindControl("lblProdmedicinefor");
                Label lblProdPcost = (Label)gr.FindControl("lblProdPcost");
                Label lblProdScost = (Label)gr.FindControl("lblProdScost");
                Label lblProdoffer = (Label)gr.FindControl("lblProdoffer");
                HiddenField HDFID = (HiddenField)gr.FindControl("HDFProdID");
                ImageButton IMGBTNcategoryisActive = (ImageButton)gr.FindControl("IMGBTNProdisActive");
                Image IMGProd = (Image)gr.FindControl("IMGProd");
                ProdTable u = e.Row.DataItem as ProdTable;
                objitem = null;
                objitem = ObjprodClass.GetItemsByID(Convert.ToInt32(u.ItemId));
                if (objitem != null)
                {
                    objitempurchase = ObjprodClass.GetItempurchaseByID(Convert.ToInt32(u.PurchaseId));
                    objitemsell = ObjprodClass.GetItemsellByID(Convert.ToInt32(u.SellId));
                    objprodctg = ObjprodClass.GetProdSubcategoryByID(Convert.ToInt32(u.CategoryId));
                    objprodtype = ObjprodClass.GetProdTypeByID(Convert.ToInt32(u.TypeId));
                    objprodsupple = ObjprodClass.GetProdsupplymentByID(Convert.ToInt32(u.SupplementId));
                    Objprodcomp = ObjprodClass.GetProdcompByID(Convert.ToInt32(u.CompanyId));
                    objmed = ObjprodClass.GetProdmedicineByID(Convert.ToInt32(u.MedicineForId));
                    objoffer = ObjprodClass.GetProdOfferByID(Convert.ToInt32(u.OfferId));
                    if (objitempurchase != null && objitemsell != null & objprodctg != null
                        && objprodtype != null & objprodsupple != null && Objprodcomp != null
                        & objmed != null && objoffer != null)
                    {
                        lblprodname.Text = objitem.ItemName.ToString().Trim();
                        lblProdctg.Text = objprodctg.SubCategoryName.ToString().Trim();
                        lblProdtype.Text = objprodtype.Name.ToString().Trim();
                        lblProdsupp.Text = objprodsupple.Name.ToString().Trim();
                        lblProdcomp.Text = Objprodcomp.CompanyName.ToString().Trim();
                        lblProdmedicinefor.Text = objmed.Name.ToString().Trim();
                        lblProdoffer.Text = objoffer.OfferPercent.ToString().Trim();
                        lblProdPcost.Text = objitempurchase.Cost.ToString().Trim();
                        lblProdScost.Text = objitemsell.Cost.ToString().Trim();
                        HDFID.Value = u.Id.ToString();
                        IMGProd.ImageUrl = u.ImageUrl;

                        if (u.IsActive == true)
                        {
                            IMGBTNcategoryisActive.ImageUrl = "~/images/tick.png";
                        }
                        else
                            IMGBTNcategoryisActive.ImageUrl = "~/images/close.jpg";
                    }
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.ToString());
            }
        }
    }
Exemplo n.º 5
0
 public string UpdateProdOffer(ProdOffer orduser)
 {
     TransactionManager transaction = null;
     try
     {
         transaction = DataRepository.Provider.CreateTransaction();
         transaction.BeginTransaction();
         if (DataRepository.ProdOfferProvider.Update(orduser))
         {
             // Show proper message
         }
         else
         {
             return "Information could not be saved.";
         }
         transaction.Commit();
         return "Information Update successfully.";
     }
     catch (Exception e)
     {
         transaction.Rollback();
         return "Information could not be saved.Please contact Administrator.";
     }
 }