Ejemplo 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)
                    {
                        InvSupplier supplier = new ClsSupplier().get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtName.Text    = supplier.Name;
                        txtmail.Text    = supplier.Email;
                        txtPhone.Text   = supplier.Phone;
                        txtRemarks.Text = supplier.Remarks;
                        txtAddress.Text = supplier.Address;
                        btnEdit.Visible = true;
                    }
                }
            }
        }
Ejemplo n.º 2
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)
                    {
                        InvSupplier supplier = new ClsSupplier().get(Convert.ToInt32(Request.QueryString["id"].ToString()));
                        txtName.Text    = supplier.Name;
                        txtmail.Text    = supplier.Email;
                        txtPhone.Text   = supplier.Phone;
                        txtRemarks.Text = supplier.Remarks;
                        txtAddress.Text = supplier.Address;
                        btnSave.Visible = false;
                        btnEdit.Visible = true;
                    }
                    else
                    {
                        btnSave.Visible = true;
                        btnEdit.Visible = false;
                    }
                }
            }
        }
Ejemplo n.º 3
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            InvSupplier supplier = new InvSupplier();

            supplier.Name    = txtName.Text;
            supplier.Email   = txtmail.Text;
            supplier.Phone   = txtPhone.Text;
            supplier.Remarks = txtRemarks.Text;
            supplier.Address = txtAddress.Text;
            supplier.Active  = 1;
            HttpCookie myCookie = Request.Cookies["user"];

            supplier.OperatorID = Convert.ToInt32(myCookie.Values["userid"].ToString());
            int res = new ClsSupplier().insert(supplier);

            if (res > 0)
            {
                Response.Redirect("~/Inventory/Suppliers.aspx?alert=success");
            }
            else
            {
                Response.Redirect("~/Inventory/AddSupplier.aspx?id=0&&alret=notpass");
            }
        }