Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "notpass")
                {
                    Response.Write("<script>alert('لم يتم الحفظ');</script>");
                }

                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        ProductCategory productCategory = new clsProductCategory().get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtProductCategory.Text     = productCategory.Name;
                        txtCategoryDescription.Text = productCategory.Description;
                        btnEdit.Visible             = true;
                    }
                }
            }
        }
        public static List <clsProductCategory> EditData(clsProductCategory Obj)
        {
            List <clsProductCategory> details = new List <clsProductCategory>();
            DataTable dt = new DataTable();

            SqlParameter[] p = new SqlParameter[1];
            p[0] = new SqlParameter("@CategoryCode", Obj.CategoryCode);
            dt   = clsCURD.GetData("[IMIS_ProProductCategorySelectByID]", p);
            foreach (DataRow dtrow in dt.Rows)
            {
                clsProductCategory obj = new clsProductCategory();
                obj.CategoryCode = int.Parse(dtrow["CategoryCode"].ToString());
                obj.GroupID      = int.Parse(dtrow["GroupID"].ToString());
                obj.CategoryName = dtrow["CategoryName"].ToString();
                obj.GroupName    = dtrow["GroupName"].ToString();
                details.Add(obj);
            }
            return(details);
        }
 public static void Update(clsProductCategory Obj)
 {
     try
     {
         SqlParameter[] p = new SqlParameter[4];
         p[0] = new SqlParameter("@CategoryCode", Obj.CategoryCode);
         p[1] = new SqlParameter("@CategoryName", Obj.CategoryName);
         p[2] = new SqlParameter("@GroupID", Obj.GroupID);
         p[3] = new SqlParameter("@LastUpdatedBy", Obj.LastUpdatedBy);
         clsCURD.ExecuteStoreProcedure("IMIS_ProProductCategoryUpdate", p);
     }
     catch (SqlException Sexp)
     {
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
 public static void Insert(clsProductCategory Obj)
 {
     try
     {
         //CategoryName, GroupID, StoreID, UserID
         SqlParameter[] p = new SqlParameter[3];
         p[0] = new SqlParameter("@CategoryName", Obj.CategoryName);
         p[1] = new SqlParameter("@GroupID", Obj.GroupID);
         p[2] = new SqlParameter("@UserID", Obj.UserID);
         clsCURD.ExecuteStoreProcedure("IMIS_ProProductCategoryInsert", p);
     }
     catch (SqlException Sexp)
     {
     }
     catch (Exception ex)
     {
     }
     finally
     {
     }
 }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Security
            if (Request.Cookies["user"] == null)
            {
                Response.Redirect("~/Default.aspx");
            }
            //else
            //{
            //    if (!new UserSecurity().CheckFormPermission((int)Global.formSecurity.AddBank, Request.Cookies["user"]["Permission"].ToString()))
            //        Response.Redirect("~/Finance_Module/UnAuthorized.aspx");
            //}

            if (!IsPostBack)
            {
                if (Request.QueryString["alert"] == "notpass")
                {
                    Response.Write("<script>alert('لم يتم الحفظ');</script>");
                }

                if (Request.QueryString["id"].ToString() != null)
                {
                    if (Convert.ToInt32(Request.QueryString["id"].ToString()) > 0)
                    {
                        ProductCategory productCategory = new clsProductCategory().get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtProductCategory.Text     = productCategory.Name;
                        txtCategoryDescription.Text = productCategory.Description;

                        btnSave.Visible = false;
                        btnEdit.Visible = true;
                    }
                    else
                    {
                        btnSave.Visible = true;
                        btnEdit.Visible = false;
                    }
                }
            }
        }