Пример #1
0
        public string insertProdCategory(ProdCategory orduser)
        {
            TransactionManager transaction = null;
            try
            {
                transaction = DataRepository.Provider.CreateTransaction();
                transaction.BeginTransaction();

                orduser.IsActive = true;
                if (DataRepository.ProdCategoryProvider.Insert(orduser))
                {
                    // Show proper message
                }
                else
                {
                    return "Information could not be saved.";
                }
                transaction.Commit();
                return "Information Insert successfully.";
            }
            catch (Exception e)
            {
                transaction.Rollback();
                return "Information could not be saved.Please contact Administrator.";
            }
        }
Пример #2
0
 private void BindRepeater()
 {
     objprodctg = ObjprodClass.GetProdcategoryByID(Convert.ToInt32(Session["CTGID"]));
     if (objprodctg != null)
     {
         prodCtgName.Text = objprodctg.Name;
         IEnumerable<int> objprodsubCtg;
         objprodsubCtg = ObjprodClass.GetAllProdmapBymainCtgID(objprodctg.Id);
         if (objprodsubCtg != null)
         {
             objenumprodtable = objctgprodclass.GetproductsByCtgID(objprodsubCtg);
             if (objenumprodtable != null)
             {
                 rptProdByctg.DataSource = objenumprodtable;
                 rptProdByctg.DataBind();
                 TtlProds.Text = objenumprodtable.Count() + " Products";
             }
         }
         List<Product> objp = new List<Product>();
         objp = Product.AddValuesToDataList();
         MnuDtlst.DataSource = objp;
         MnuDtlst.DataBind();
     }
     else
     {
         Response.Redirect("~/Home.aspx", false);
     }
 }
Пример #3
0
 protected void grdprodsubctg_RowDataBound(object sender, GridViewRowEventArgs e)
 {
     if (e.Row.RowType == DataControlRowType.DataRow && e.Row.DataItem != null)
     {
         try
         {
             GridViewRow gr = e.Row;
             Label lblCategoryname = (Label)gr.FindControl("lblCategoryname");
             Label lblProdparentctg = (Label)gr.FindControl("lblProdparentctg");
             HiddenField HDFID = (HiddenField)gr.FindControl("HDFProdsubctgID");
             ImageButton IMGBTNProdsubCTGisActive = (ImageButton)gr.FindControl("IMGBTNProdsubCTGisActive");
             ProdSubcategory u = e.Row.DataItem as ProdSubcategory;
             objprodctgmappinglist = ObjprodClass.GetAllProdCategoriesmapping(u.Id);
             string name = null;
             if (objprodctgmappinglist != null)
             {
                 name = null;
                 foreach (var r in objprodctgmappinglist)
                 {
                     objprodmainctg = ObjprodClass.GetProdcategoryByID( Convert.ToInt32(r.CategoryId));
                     if (name != null)
                     {
                         name = name + "," + objprodmainctg.Name;
                     }
                     else
                     {
                         name = objprodmainctg.Name;
                     }
                 }
             }
             lblCategoryname.Text = u.SubCategoryName.Trim().ToString();
             HDFID.Value = u.Id.ToString();
             lblProdparentctg.Text = name.ToString();
             if (u.IsActive == true)
             {
                 IMGBTNProdsubCTGisActive.ImageUrl = "~/images/tick.png";
             }
             else
                 IMGBTNProdsubCTGisActive.ImageUrl = "~/images/close.jpg";
         }
         catch
         {
         }
     }
 }
Пример #4
0
 protected void IMGBTNcategoryisActive_Click(object sender, ImageClickEventArgs e)
 {
     ImageButton lnk = (ImageButton)sender;
     int userid = Convert.ToInt32(lnk.CommandArgument);
     objprodctg = null;
     objprodctg = ObjprodClass.GetProdcategoryByID(userid);
     if (objprodctg != null)
     {
         if (objprodctg.IsActive == true)
             ChkIsActive.Checked = true;
         TXTcategory.Text = objprodctg.Name;
         errorpopupStatus.Style.Add("display", "none");
         DIVIsActive.Style.Add("display", "block");
         btnSubmit.Text = "Update";
         ViewState["popupID"] = userid.ToString();
         ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPUpdate('true');});", true);
     }
 }
Пример #5
0
    protected void btnSubmit_Click1(object sender, EventArgs e)
    {
        string categoryname = TXTcategory.Text;
        if (categoryname != null)
        {
            objprodctg.Name = categoryname.ToString();
            objprodctg.CreatedDate = DateTime.Now;
            switch (btnSubmit.Text.Trim())
            {
                case "Submit":
                    ViewState["popupID"] = null;
                    Status = ObjprodClass.insertProdCategory(objprodctg);
                    if (Status == "Information Insert successfully.")
                    {
                        errorpopupStatus.Visible = true;
                        errorpopupStatus.Style.Add("display", "block");
                        errorpopupStatus.Attributes.Add("class", "fk-msg-success");
                        errorpopupStatus.InnerHtml = "Productcategory Inserted successfully";
                        BindProdCategoryGrid();
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUP('true');});", true);
                    }
                    else
                    {
                        errorpopupStatus.Visible = true;
                        errorpopupStatus.Style.Add("display", "block");
                        errorpopupStatus.Attributes.Add("class", "fk-err-all");
                        errorpopupStatus.InnerHtml = Status;
                        ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUP('true');});", true);
                    }
                    break;
                case "Update":
                    if (ViewState["popupID"] != null && ViewState["popupID"] != "")
                    {
                        objprodctg = null;
                        objprodctg = ObjprodClass.GetProdcategoryByID(Convert.ToInt32(ViewState["popupID"]));
                        objprodctg.Name = categoryname.ToString();
                        if (ChkIsActive.Checked)
                            objprodctg.IsActive = true;
                        else
                            objprodctg.IsActive = false;
                        Status = ObjprodClass.UpdateProdCategory(objprodctg);
                        if (Status == "Information Update successfully.")
                        {
                            errorpopupStatus.Visible = true;
                            errorpopupStatus.Style.Add("display", "block");
                            errorpopupStatus.Attributes.Add("class", "fk-msg-success");
                            errorpopupStatus.InnerHtml = "Productcategory Updated successfully";
                            BindProdCategoryGrid();
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPUpdate('true');});", true);
                        }
                        else
                        {
                            errorpopupStatus.Visible = true;
                            errorpopupStatus.Style.Add("display", "block");
                            errorpopupStatus.Attributes.Add("class", "fk-err-all");
                            errorpopupStatus.InnerHtml = Status;
                            ScriptManager.RegisterStartupScript(this, typeof(Page), "aa", "jQuery(document).ready(function(){ShowPOPUPUpdate('true');});", true);
                        }
                    }
                    break;
            }


        }
    }
Пример #6
0
 public ProdCategory GetProdcategoryByID(int id)
 {
     Objprodcategory = null;
     Objprodcategory = DataRepository.ProdCategoryProvider.GetById(id);
     return Objprodcategory;
 }