Beispiel #1
0
 protected void Button1_Click(object sender, EventArgs e)
 {
     if (this.TextBox1.Text != null)
     {
         UserType s = new UserType();
         s.SubClassName = this.TextBox1.Text;
         s.UserTypeID   = Convert.ToInt32(this.DropDownList1.SelectedValue);
         //s.State = this.DropDownList2.Text;
         if (this.DropDownList2.Text == "正常")
         {
             s.State = "Y";
         }
         else
         {
             s.State = "N";
         }
         int rows = UserTypeManager.UserTypeInsert(s);
         if (rows > 0)
         {
             Response.Write("<script>alert('添加成功!');</script>");
             this.DropDownList1.SelectedIndex = 1;
             this.TextBox1.Text      = "";
             this.DropDownList2.Text = "正常";
         }
         else
         {
             Response.Write("<script>alert('添加失败!');</script>");
         }
     }
     else
     {
         Response.Write("<script>alert('类型名称不能为空!');</script>");
     }
 }
Beispiel #2
0
        public override void Init()
        {
            Logger.LogInfo("I'm InjectLogin Plugin,I'm made in CHINA");
            Logger.LogInfo("Add User Type \"Inject\" to User Login Pane");
            LoginUserType usertype = new LoginUserType();


            usertype.HaveGUI   = "true";
            usertype.LoginText = "外置登录";
            var icon = new PackIcon()
            {
                Width = double.NaN, Height = double.NaN, Kind = PackIconKind.AccountReactivateOutline
            };

            usertype.Icon = icon;
            usertype.user = new InjectUser();
            usertype.AllowedLoginPanel = new LoginPane();
            UserTypeManager.AddUserType(usertype);
            Logger.LogInfo("Added");
            EventHelper.OnWindowLoaded += (object s, EventArgs e) =>
            {
                ColorHelper.BingdingBackgroundedForegoundToControl(icon);
            };
            Logger.LogInfo("Binded Color");
        }
Beispiel #3
0
 public UserManagementController(IHostEnvironment _host, IDataRepository <User> _UserManager, IDataRepository <UserType> _UserTypeManager, IDataRepository <UserTypeUser> _UserTypeUserManager)
 {
     this.host                 = _host;
     this._UserManager         = (UserManager)_UserManager;
     this._UserTypeManager     = (UserTypeManager)_UserTypeManager;
     this._UserTypeUserManager = (UserTypeUserManager)_UserTypeUserManager;
 }
Beispiel #4
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     if (context.Request["id"] != null)
     {
         context.Response.Write(UserTypeManager.UserTypeDelete(Convert.ToInt32(context.Request["id"])) > 0);
     }
 }
Beispiel #5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int index = Convert.ToInt32(context.Request["rows"]);
            int rows  = Convert.ToInt32(context.Request["page"]);

            context.Response.Write("{\"total\":" + UserTypeManager.UserTypezong() + ",\"rows\":" + JsonConvert.SerializeObject(UserTypeManager.UserTypeALL(index, rows)) + "}");
        }
Beispiel #6
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     if (context.Request["id"] != null)
     {
         context.Response.Write(JsonConvert.SerializeObject(UserTypeManager.UserTypeID(Convert.ToInt32(context.Request["id"]))));
     }
 }
Beispiel #7
0
        //Method to Fill Drop-DownList
        protected void FillDataList()
        {
            var userTypes = UserTypeManager.getAllUserTypes();

            foreach (tblUserType userType in userTypes)
            {
                ListItem i = new ListItem(userType.Name, userType.UserTypeID.ToString());
                list_userType.Items.Add(i);
            }
        }
Beispiel #8
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         this.DropDownList1.DataSource     = UserTypeManager.UserTypeDrop();
         this.DropDownList1.DataTextField  = "TypeName";
         this.DropDownList1.DataValueField = "UserTypeID";
         this.DropDownList1.DataBind();
     }
 }
Beispiel #9
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     if (context.Request["SubClassName"] != null)
     {
         UserType s = new UserType();
         s.SubClassID   = Convert.ToInt32(context.Request["id"]);
         s.UserTypeID   = Convert.ToInt32(context.Request["UserTypeID"]);
         s.SubClassName = context.Request["SubClassName"];
         s.State        = context.Request["State"];
         context.Response.Write(UserTypeManager.UserTypeUpdate(s) > 0);
     }
 }
Beispiel #10
0
 public SpeakingManagerController(
     IHostEnvironment _host,
     IDataRepository <User> _UserManager,
     IDataRepository <UserType> _UserTypeManager,
     IDataRepository <TestCategory> _TestCategoryManager,
     IDataRepository <SpeakingEmbed> _SpeakingEmbedManager)
 {
     host = _host;
     this._UserManager          = (UserManager)_UserManager;
     this._UserTypeManager      = (UserTypeManager)_UserTypeManager;
     this._TestCategoryManager  = (TestCategoryManager)_TestCategoryManager;
     this._SpeakingEmbedManager = (SpeakingEmbedManager)_SpeakingEmbedManager;
 }
Beispiel #11
0
 protected void userTypeList_SelectedIndexChanged(object sender, EventArgs e)
 {
     btn_save.Text     = "Update";
     tb_userType.Text  = "";
     hdn_fieldID.Value = userTypeList.DataKeys[this.userTypeList.SelectedRow.RowIndex].Values[0].ToString();
     if (!string.IsNullOrEmpty(hdn_fieldID.Value))
     {
         tblUserType dbobj = UserTypeManager.getUserTypeById(new Guid(hdn_fieldID.Value));
         if (dbobj != null)
         {
             tb_userType.Text = dbobj.Name;
         }
     }
 }
Beispiel #12
0
 public WritingManagerController(
     IHostEnvironment _host,
     IDataRepository <User> _UserManager,
     IDataRepository <UserType> _UserTypeManager,
     IDataRepository <TestCategory> _TestCategoryManager,
     IDataRepository <WritingPartOne> _WritingPartOneManager,
     IDataRepository <WritingPartTwo> _WritingPartTwoManager)
 {
     host = _host;
     this._UserManager           = (UserManager)_UserManager;
     this._UserTypeManager       = (UserTypeManager)_UserTypeManager;
     this._TestCategoryManager   = (TestCategoryManager)_TestCategoryManager;
     this._WritingPartOneManager = (WritingPartOneManager)_WritingPartOneManager;
     this._WritingPartTwoManager = (WritingPartTwoManager)_WritingPartTwoManager;
 }
Beispiel #13
0
        public ListeningManagerController(
            IHostEnvironment _host,
            IDataRepository <User> _UserManager,
            IDataRepository <UserType> _UserTypeManager,
            IDataRepository <TestCategory> _TestCategoryManager,
            IDataRepository <ListeningMedia> _ListeningMediaManager,
            IDataRepository <ListeningBaseQuestion> _ListeningBaseQuestionManager)
        {
            host = _host;

            this._UserManager                  = (UserManager)_UserManager;
            this._UserTypeManager              = (UserTypeManager)_UserTypeManager;
            this._TestCategoryManager          = (TestCategoryManager)_TestCategoryManager;
            this._ListeningMediaManager        = (ListeningMediaManager)_ListeningMediaManager;
            this._ListeningBaseQuestionManager = (ListeningBaseQuestionManager)_ListeningBaseQuestionManager;
        }
Beispiel #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            heading.Text = "Add User Type";
            bindData();
            lblerrormsg.Text = "  ";

            if (!IsPostBack)
            {
                if (!string.IsNullOrEmpty(Request.QueryString["id"]))
                {
                    try
                    {
                        hdn_fieldID.Value = Request.QueryString["id"];
                        if (!string.IsNullOrEmpty(hdn_fieldID.Value))
                        {
                            btn_save.Text = "Update";
                            heading.Text  = "Update User Type";
                            tblUserType dbobj = UserTypeManager.getUserTypeById(new Guid(hdn_fieldID.Value));
                            if (dbobj != null)
                            {
                                tb_userType.Text = dbobj.Name;
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        lblerrormsg.Text = ex.Message;
                    }
                }

                if (!string.IsNullOrEmpty(Request.QueryString["stat"]))
                {
                    string message = Request.QueryString["stat"];
                    if (message == "updateSuccess")
                    {
                        lblerrormsg.Text = "User Type Updated Successfully";
                    }
                    else if (message == "updateFail")
                    {
                        lblerrormsg.Text = "Could Not Update User Type";
                    }
                }
            }
        }
Beispiel #15
0
        protected void userTypeList_RowDeleting(object sender, GridViewDeleteEventArgs e)
        {
            //Fetch the Id of the Current userType that is we want to delete
            try
            {
                hdn_fieldID.Value = userTypeList.DataKeys[e.RowIndex].Values[0].ToString();
            }
            catch (Exception ex)
            {
                lblerrormsg.Text = ex.Message;
            }

            /*
             * //Validate if such Category is being used by any od the users or not!
             * //Fetch all userTypes being selected
             * //Later to be changed to Guid
             * foreach (UserDetail user in UserManager.GetAllUsers()) {
             *  try
             *  {
             *      if (hdn_fieldID.Value == user.UserType) {
             *          lblerrormsg.Text = "Cannot Delete UserType! The userType is being applied to existing Users!!";
             *          return;
             *      }
             *  }
             *  catch (Exception ex) {
             *      lblerrormsg.Text = ex.Message;
             *  }
             * }*/

            if (!string.IsNullOrEmpty(hdn_fieldID.Value))
            {
                tblUserType dbUserType = UserTypeManager.getUserTypeById(new Guid(hdn_fieldID.Value));

                if (dbUserType != null)
                {
                    bool statusOfDelete = UserTypeManager.deleteUserType(dbUserType);

                    lblerrormsg.Text  = statusOfDelete ? "UserType Deleted Successfully!!" : "Couldnot Delete UserType";
                    hdn_fieldID.Value = "";
                    bindData();
                }
            }
        }
        private void FillDDL()
        {
            UserTypeManager _UserTypeManager = new UserTypeManager();
            var             obj = _UserTypeManager.GetAllUserType();

            if (obj != null)
            {
                if (CurrentCultureinfo == "ar")
                {
                    ddlUserType.DataTextField = "NameAr";
                }
                else
                {
                    ddlUserType.DataTextField = "NameEn";
                }

                ddlUserType.DataValueField = "Id";
                ddlUserType.DataSource     = obj.ToList();
            }
            ddlUserType.DataBind();

            NotificationLevelManager _NotificationLevelManager = new NotificationLevelManager();
            var lvl = _NotificationLevelManager.GetAllNotificationLevel();

            if (lvl != null)
            {
                if (CurrentCultureinfo == "ar")
                {
                    ddlNotificationLevel.DataTextField = "NameAr";
                }
                else
                {
                    ddlNotificationLevel.DataTextField = "NameEn";
                }

                ddlNotificationLevel.DataValueField = "Id";
                ddlNotificationLevel.DataSource     = lvl.ToList();
            }
            ddlNotificationLevel.DataBind();
        }
Beispiel #17
0
        protected void btn_save_Click(object sender, EventArgs e)
        {
            //Check if Empty or not
            if (string.IsNullOrEmpty(tb_userType.Text))
            {
                lblerrormsg.Text = "UserType Column Cannot be Empty!!";
                tb_userType.Focus();
                return;
            }

            //Check if already Inserted or not
            foreach (tblUserType UserType in UserTypeManager.getAllUserTypes())
            {
                if (UserType.Name.ToUpper() == tb_userType.Text.ToUpper())
                {
                    lblerrormsg.Text = "UserType Duplicate!! Already Inserted!!";
                    tb_userType.Focus();
                    tb_userType.Text = "";
                    return;
                }
            }

            //To Find if it is a case of Insert or Update
            bool isInsert;

            //Create an Object of Talbe /class tblUserType
            tblUserType userType = new tblUserType();


            if (string.IsNullOrEmpty(hdn_fieldID.Value))
            {
                //Case of Creating a new user Type
                userType.UserTypeID = Guid.NewGuid();
                isInsert            = true;
            }
            else
            {
                //Case of Updating a user type
                userType.UserTypeID = new Guid(hdn_fieldID.Value);
                isInsert            = false;
            }

            userType.Name = tb_userType.Text;

            bool status = UserTypeManager.insertUserType(userType, isInsert);

            //Confirmation of Insert/Edit to the User
            if (status)
            {
                bindData();

                if (isInsert)
                {
                    lblerrormsg.Text = "SuccessFully Inserted New UserType!!";
                }
                else
                {
                    string stat = "updateSuccess";
                    Response.Redirect("~/Web/User/UserTypeList.aspx?stat=" + stat);
                }
            }
            else
            {
                if (isInsert)
                {
                    lblerrormsg.Text = "Cannot Insert New UserType";
                }
                else
                {
                    string stat = "updateFail";
                    Response.Redirect("~/Web/User/UserTypeList.aspx?stat=" + stat);
                }
            }
        }
Beispiel #18
0
 protected void bindData()
 {
     userTypeList.DataSource = UserTypeManager.getAllUserTypes();
     userTypeList.DataBind();
 }
Beispiel #19
0
 public void ProcessRequest(HttpContext context)
 {
     context.Response.ContentType = "text/plain";
     context.Response.Write(JsonConvert.SerializeObject(UserTypeManager.UserTypeDrop()));
 }
Beispiel #20
0
 public AuthenticationController(IDataRepository <User> _UserManager, IDataRepository <UserType> _UserTypeManager)
 {
     this._UserManager     = (UserManager)_UserManager;
     this._UserTypeManager = (UserTypeManager)_UserTypeManager;
 }
 public TestCategoryController(IDataRepository <User> _UserManager, IDataRepository <UserType> _UserTypeManager, IDataRepository <TestCategory> _TestCategoryManager)
 {
     this._UserManager         = (UserManager)_UserManager;
     this._UserTypeManager     = (UserTypeManager)_UserTypeManager;
     this._TestCategoryManager = (TestCategoryManager)_TestCategoryManager;
 }