Example #1
0
        public string LoadUsers()
        {
            PLog.Info("BEGIN::Controller > Home, Method > LoadUsers()");
            List <Dictionary <string, object> > rows = new List <Dictionary <string, object> >();

            System.Web.Script.Serialization.JavaScriptSerializer serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            try
            {
                UsersImple objUsersImple = new UsersImple();

                DataTable dt = objUsersImple.GetGridData(0); //0 will gets all the users data


                Dictionary <string, object> row;
                foreach (DataRow dr in dt.Rows)
                {
                    row = new Dictionary <string, object>();
                    foreach (DataColumn col in dt.Columns)
                    {
                        row.Add(col.ColumnName, dr[col]);
                    }
                    rows.Add(row);
                }
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > LoadUsers()", ex);
            }
            PLog.Info("END::Controller > Home, Method > LoadUsers()");
            return(serializer.Serialize(rows));
        }
Example #2
0
        public ActionResult SaveUser(string Data)
        {
            PLog.Info("BEGIN::Controller > Home, Method > SaveUser(string Data)");
            long flg = 0;

            try
            {
                UsersImple objUsersImple = new UsersImple();
                UsersModel objUser       = JsonConvert.DeserializeObject <UsersModel>(Data);

                flg = objUsersImple.SaveUsers(objUser);
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > SaveUser(string Data)", ex);
            }
            PLog.Info("END::Controller > Home, Method > SaveUser(string Data)");
            return(Content(flg.ToString()));
        }
Example #3
0
        public ActionResult UpDateUser(string ID)
        {
            PLog.Info("BEGIN::Controller > Home, Method > UpDateUser(string ID)");
            UsersImple objUsersImple = new UsersImple();
            UsersModel objModel      = null;

            try
            {
                if (!string.IsNullOrEmpty(ID))
                {
                    objModel = objUsersImple.EditUser(Convert.ToInt32(ID));
                }
            }
            catch (Exception ex)
            {
                PLog.Error("Error::Controller > Home, Method > UpDateUser(string ID)", ex);
            }
            PLog.Info("END::Controller > Home, Method > UpDateUser(string ID)");
            return(View("UserCreation", objModel));
        }
Example #4
0
        public long DeleteUser(string ID)
        {
            PLog.Info("BEGIN::Controller > Home, Method > DeleteUser(string ID)");
            long ret = 0;

            if (!string.IsNullOrEmpty(ID))
            {
                try
                {
                    UsersImple objUsersImple = new UsersImple();
                    ret = objUsersImple.DeleteUser(Convert.ToInt32(ID));
                }
                catch (Exception ex)
                {
                    PLog.Error("Error::Controller > Home, Method > DeleteUser(string ID)", ex);
                }
            }
            PLog.Info("END::Controller > Home, Method > DeleteUser(string ID)");
            return(ret);
        }
Example #5
0
        public ActionResult ChangePassword(string CurrentPassword, string NewPassword)
        {
            PLog.Info("BEGIN::Controller > Home, Method > ChangePasswordView(string CurrentPassword, string NewPassword)");
            long ret = 0;

            if (!string.IsNullOrEmpty(CurrentPassword) && !string.IsNullOrEmpty(NewPassword))
            {
                try
                {
                    UsersImple         objUsersImple = new UsersImple();
                    ModelImple.LookUps _LookUps      = new ModelImple.LookUps();
                    ret = objUsersImple.ChangePassword(CurrentPassword, NewPassword, Convert.ToInt32(_LookUps.GetSessionObject("UserID")));
                }
                catch (Exception ex)
                {
                    PLog.Error("Error::Controller > Home, Method > ChangePasswordView(string CurrentPassword, string NewPassword)", ex);
                }
            }
            PLog.Info("END::Controller > Home, Method >ChangePasswordView(string CurrentPassword, string NewPassword)");
            return(Content(ret.ToString()));
        }