示例#1
0
        public Status GroupInsert(Stream jsData)
        {
            string       strGetData = CommonFunctions.ReadJSON(jsData);
            GroupDetails objGroup   = new GroupDetails();

            try
            {
                objGroup             = new JavaScriptSerializer().Deserialize <GroupDetails>(strGetData);
                objGroup.CreatedUser = UtilCipher.Decrypt(objGroup.CreatedUser.ToString());
            }
            catch (Exception) {
                return(new Status()
                {
                    StatusId = AppConstant.HackeAccess, MsgDesc = AppConstant.ErrorHackerMsg
                });
            }

            try
            {
                return(new GroupController().Insert(objGroup));
            }
            catch (Exception ex)
            {
                LogManager.LogMessage(ex, new MessageStructure("Group Creation", MessageSeverity.Exception));
                return(new Status()
                {
                    StatusId = AppConstant.Exception, MsgDesc = AppConstant.ExceptionMsg
                });
            }
        }
示例#2
0
        public GroupList GetGroup(int userId)
        {
            DbParameter[] parameter =
            {
                DataParameter.GetSqlParam(dbUserEnity.CustomerID.ToString(), SqlDbType.Int, 50, userId, ParameterDirection.Input),
            };
            try
            {
                GroupList objGroupList  = new GroupList();
                var       drUserDetails = CommonDBFunctions.ExecuteDataSet(spUser.spUserLogin.ToString(), parameter);
                if (drUserDetails.Tables.Count > 0)
                {
                    //  new Status() { StatusId = AppConstant.Success, MsgDesc = success };
                    if (drUserDetails.Tables.Count == 1)
                    {
                        if (drUserDetails.Tables[1].Rows.Count > 0)
                        {
                            objGroupList.status = new Status()
                            {
                                StatusId = AppConstant.Success, MsgDesc = AppConstant.SuccessMsg
                            };
                        }
                        else
                        {
                            objGroupList.status = new Status()
                            {
                                StatusId = AppConstant.Information, MsgDesc = "No record"
                            };
                        }
                        foreach (DataRow dr in drUserDetails.Tables[1].Rows)
                        {
                            GroupDetails objGroup = new GroupDetails();
                            objGroup.GroupName   = dr[dbUserEnity.FirstName.ToString()].ToString();
                            objGroup.StatusMsg   = dr[dbUserEnity.FirstName.ToString()].ToString();
                            objGroup.Desc        = dr[dbUserEnity.FirstName.ToString()].ToString();
                            objGroup.CreatedUser = dr[dbUserEnity.FirstName.ToString()].ToString();
                            // objGroup.Status = dr[dbUserEnity.FirstName.ToString()].ToString();
                            objGroup.CreatedDate = Convert.ToDateTime(dr[dbUserEnity.LastLogin.ToString()].ToString());
                            objGroup.GroupID     = UtilCipher.Encrypt(dr[dbUserEnity.CustomerID.ToString()].ToString());
                            objGroup.IsAdmin     = Convert.ToBoolean(dr[dbUserEnity.FirstName.ToString()]);
                            objGroupList.groups.Add(objGroup);
                        }
                    }
                }


                return(objGroupList);
            }
            catch (SqlException ex)
            {
                throw ex;
            }
        }
示例#3
0
        public Login Login(UserEnity user)
        {
            DbParameter[] parameter =
            {
                DataParameter.GetSqlParam(dbUserEnity.UserName.ToString(), SqlDbType.VarChar, 50, user.UserName, ParameterDirection.Input),
                DataParameter.GetSqlParam(dbUserEnity.Password.ToString(), SqlDbType.VarChar, 50, user.Password, ParameterDirection.Input),
            };

            DataHelper    helper    = null;
            SqlDataReader sqlReader = null;
            Login         objLogin  = new Login();

            try
            {
                helper = new DataHelper(CommonFunctions.GetConnectionString());
                var drUserDetails = helper.ExecuteDataSet(spUser.spUserLogin.ToString(), parameter);
                if (drUserDetails.Tables.Count > 0)
                {
                    foreach (DataRow dr in drUserDetails.Tables[0].Rows)
                    {
                        string success = string.Empty;
                        switch (Convert.ToInt32(dr["LOGINSTATUS"]))
                        {
                        case 1:
                            success = AppConstant.SuccessMsg;
                            break;

                        case 2:
                            success = "User Removed";
                            break;

                        case 8:
                            success = "User Locked";
                            break;

                        case 9:
                            success = "Not activation";
                            break;
                        }

                        objLogin.status = new Status()
                        {
                            StatusId = AppConstant.Success, MsgDesc = success
                        };
                    }
                    if (drUserDetails.Tables.Count == 2)
                    {
                        foreach (DataRow dr in drUserDetails.Tables[1].Rows)
                        {
                            objLogin.user             = new UserEnity();
                            objLogin.user.UserType    = (Convert.ToInt32(dr[dbUserEnity.Type.ToString()]) == 1)?"user":"******";
                            objLogin.user.CreatedUser = UtilCipher.Encrypt(dr[dbUserEnity.CustomerID.ToString()].ToString());
                            objLogin.user.Email       = dr[dbUserEnity.Email.ToString()].ToString();
                            objLogin.user.FirstName   = dr[dbUserEnity.FirstName.ToString()].ToString();
                            objLogin.user.LastName    = dr[dbUserEnity.LastName.ToString()].ToString();
                            objLogin.user.LastLogin   = Convert.ToDateTime(dr[dbUserEnity.LastLogin.ToString()].ToString());
                        }
                    }
                }
            }
            catch (Exception e)
            {
            }
            finally
            {
                if (sqlReader != null)
                {
                    sqlReader.Close();
                    sqlReader.Dispose();
                }
            }
            return(objLogin);
        }