Пример #1
0
        protected void btnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                bool validate = WebApiConsume.login(Utilities.BASE_URL + "/api/Users", txtuserName.Text, txtPass.Text, out string UserName, out string LoginName, out int?SystemRole, out string DepartmentId);

                if (validate)
                {
                    Session["SystemRole"] = SystemRole;
                    Session["UserName"]   = UserName;
                    Session["Name"]       = LoginName;

                    Session["DeptId"] = DepartmentId;
                    Response.Redirect("Dashboard.aspx");
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "alertMessage", "alert('دخول خطأ. تأكد من اسم المستخدم والرقم السرى')", true);
                }
            }
            catch (Exception ex)
            {
                Response.Write(ex.Message);
            }
        }