Пример #1
0
        //for Ship drp
        public void GetAllShipForDrp()
        {
            UserMasterBL          bL       = new UserMasterBL();
            List <UserMasterPOCO> pocoList = new List <UserMasterPOCO>();

            pocoList = bL.GetAllShipForDrp(/*int.Parse(Session["VesselID"].ToString())*/);


            List <UserMasterPOCO> itmasterList = new List <UserMasterPOCO>();

            foreach (UserMasterPOCO up in pocoList)
            {
                UserMasterPOCO unt = new UserMasterPOCO();
                unt.ShipId   = up.ShipId;
                unt.ShipName = up.ShipName;

                itmasterList.Add(unt);
            }
            //itmasterList.Add(new UserMasterPOCO { ShipId = -1, ShipName = "Please Select One" });
            ViewBag.Ships = itmasterList.OrderBy(s => s.ShipId).Select(x =>
                                                                       new SelectListItem()
            {
                Text  = x.ShipName,
                Value = x.ShipId.ToString()
            });
        }
Пример #2
0
        public ActionResult ApprovedRoNotInUserMaster(int UserId /*, ref string recordCount*/)
        {
            UserMasterBL bL             = new UserMasterBL();
            int          recordaffected = bL.ApprovedRoNotInUserMaster(UserId /*, ref recordCount*/);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
Пример #3
0
        public ActionResult AllowSignatureUpload(int UserId)
        {
            UserMasterBL bL             = new UserMasterBL();
            int          recordaffected = bL.AllowSignatureUpload(UserId);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
Пример #4
0
        public ActionResult UploadPermissionUserMaster(int UserId /*, ref string recordCount*/)
        {
            UserMasterBL bL             = new UserMasterBL();
            int          recordaffected = bL.UploadPermissionUserMaster(UserId /*, ref recordCount*/);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
Пример #5
0
        public JsonResult GetUserByUserId(int UserId)
        {
            UserMasterBL   bL       = new UserMasterBL();
            UserMasterPOCO pOCOList = new UserMasterPOCO();

            pOCOList = bL.GetUserByUserId(UserId);

            UserMasterPOCO dept = new UserMasterPOCO();

            dept.UserId    = pOCOList.UserId;
            dept.UserName  = pOCOList.UserName;
            dept.UserCode  = pOCOList.UserCode;//Added on 02nd Feb 2021
            dept.Password  = pOCOList.Password;
            dept.CreatedOn = pOCOList.CreatedOn;
            dept.Email     = pOCOList.Email;
            //dept.CreatedBy = pOCOList.CreatedBy;
            //dept.ModifiedBy = pOCOList.ModifiedBy;
            dept.Gender    = pOCOList.Gender;
            dept.VesselIMO = pOCOList.VesselIMO;
            dept.RankId    = pOCOList.RankId;
            dept.ShipId    = pOCOList.ShipId;

            dept.UserType = pOCOList.UserType;
            dept.IsAdmin  = pOCOList.IsAdmin;
            dept.RoleId   = pOCOList.RoleId;

            var data = dept;

            return(Json(data, JsonRequestBehavior.AllowGet));
        }
Пример #6
0
        public ActionResult ChangePassword(UserMasterPOCO aUserMaster)
        {
            try
            {
                UserMasterBL umBL    = new UserMasterBL();
                int          isValid = 0;
                if (aUserMaster.UserId == 0)
                {
                    aUserMaster.UserId = int.Parse(Session["UserId"].ToString());
                }
                isValid = umBL.ChangePassword(aUserMaster);

                if (isValid == 0)
                {
                    //return Json(isValid, JsonRequestBehavior.AllowGet);
                    aUserMaster.hasChange = 2;
                    return(View(aUserMaster));
                }
                else
                {
                    //return RedirectToAction("Login", "Home");
                    return(new RedirectToRouteResult(new RouteValueDictionary(
                                                         new { action = "Login", controller = "Home" })));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Пример #7
0
        public ActionResult GetRoleByUserId(int UserId /*, ref string recordCount*/)
        {
            UserMasterBL bL             = new UserMasterBL();
            string       recordaffected = bL.GetRoleByUserId(UserId /*, ref recordCount*/);

            return(Json(recordaffected, JsonRequestBehavior.AllowGet));
        }
Пример #8
0
        public JsonResult GenerateUserCode(string userType, string shipId, string rankId, string userName)
        {
            string       code   = "";
            UserMasterBL userBl = new UserMasterBL();

            code = userBl.GenerateUserCode(userType, shipId, rankId, userName);

            return(Json(code, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
        public void SetUserMaster(int UserID)
        {
            UserMasterBL sellerMasterBL = new UserMasterBL();

            table            = sellerMasterBL.GetUserMasterByID(UserID);
            txtName.Text     = table.Rows[0]["UserName"].ToString();
            txtPassword.Text = table.Rows[0]["Password"].ToString();
            txtStatus.Text   = table.Rows[0]["Status"].ToString();
        }
Пример #10
0
        public JsonResult LoadData()
        {
            _shipId = Convert.ToInt32(Session["ShipId"].ToString()); // Added on 17th Aug 2021
            int draw, start, length;
            int pageIndex = 0;

            if (null != Request.Form.GetValues("draw"))
            {
                draw   = int.Parse(Request.Form.GetValues("draw").FirstOrDefault().ToString());
                start  = int.Parse(Request.Form.GetValues("start").FirstOrDefault().ToString());
                length = int.Parse(Request.Form.GetValues("length").FirstOrDefault().ToString());
            }
            else
            {
                draw   = 1;
                start  = 0;
                length = 500;
            }

            if (start == 0)
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = (start / length) + 1;
            }

            UserMasterBL bL           = new UserMasterBL(); ///////////////////////////////////////////////////////////////////////////
            int          totalrecords = 0;

            List <UserMasterPOCO> pocoList = new List <UserMasterPOCO>();

            pocoList = bL.GetAllUserPageWise(pageIndex, ref totalrecords, length, Convert.ToInt32(Session["UserType"].ToString()), _shipId);
            //List<UserMasterPOCO> pList = new List<UserMasterPOCO>();
            //foreach (UserMasterPOCO pC in pocoList)
            //{
            //    UserMasterPOCO pOCO = new UserMasterPOCO();
            //    pOCO.UserId = pC.UserId;
            //    pOCO.UserName = pC.UserName;
            //    pOCO.UserCode = pC.UserCode;
            //    pOCO.CreatedOn1 = pC.CreatedOn1;
            //    pOCO.Email = pC.Email;
            //    //pOCO.CreatedBy = pC.CreatedBy;
            //    //pOCO.ModifiedBy = pC.ModifiedBy;
            //    pOCO.Gender = pC.Gender;
            //    pOCO.VesselIMO = pC.VesselIMO;
            //    //pOCO.RankName = pC.RankName;
            //    //pOCO.ShipName = pC.ShipName;

            //    pList.Add(pOCO);
            //}

            var data = pocoList;

            return(Json(new { draw = draw, recordsFiltered = totalrecords, recordsTotal = totalrecords, data = data }, JsonRequestBehavior.AllowGet));
        }
Пример #11
0
        /// <summary>
        /// this method used to get Rank by UserId
        /// and call from JS on change User
        /// </summary>
        /// <param name="userId"></param>
        /// <returns></returns>
        public JsonResult GetUserDetailsByUser(string userId)
        {
            ApproverMaster approver = new ApproverMaster();
            UserMasterBL   userBl   = new UserMasterBL();
            UserMasterPOCO user     = new UserMasterPOCO();

            user            = userBl.GetUserByUserId(Convert.ToInt32(userId));
            approver.RankId = user.RankId;
            approver.User   = user;
            return(Json(approver, JsonRequestBehavior.AllowGet));
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            UserMasterBL userBL = new UserMasterBL();

            if (dgvUserMaster.SelectedRows.Count > 0)
            {
                var id = (int)dgvUserMaster.SelectedRows[0].Cells["UserID"].Value;
                userBL.DeleteUserMaster(id);
                LoadUserMaster();
            }
        }
Пример #13
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            UserMasterBL userBL = new UserMasterBL();

            if (table == null)
            {
                userBL.AddUserMaster(txtName.Text, txtPassword.Text, txtStatus.Text);
            }
            else
            {
                userBL.UpdateUserMaster((int)table.Rows[0]["UserID"], txtName.Text, txtPassword.Text, txtStatus.Text);
            }
            this.Close();
            LoadUserMaster();
        }
        private void btnLogin_Click(object sender, EventArgs e)
        {
            UserMasterBL userMaster = new UserMasterBL();
            var          user       = userMaster.spCheckUserMasterByID(txtUserName.Text, txtPassword.Text);

            if (user == null)
            {
                MessageBox.Show("Invalid Username or Password");
            }
            else
            {
                FrmMDIParent frmMDI = new FrmMDIParent();
                this.Hide();
                frmMDI.Show();
            }
        }
Пример #15
0
        private void FrmDetailSalesContract_Load(object sender, EventArgs e)
        {
            BuyerMasterBL buyerMasterBL = new BuyerMasterBL();

            cmbBuyer.DataSource    = buyerMasterBL.GetBuyerMaster();
            cmbBuyer.DisplayMember = "CompanyName";
            cmbBuyer.ValueMember   = "ID";

            UserMasterBL userBL = new UserMasterBL();

            cmbUserMaster.DataSource    = userBL.GetUserMaster();
            cmbUserMaster.DisplayMember = "UserName";
            cmbUserMaster.ValueMember   = "UserName";

            cmbApprovedBy.DataSource    = userBL.GetUserMaster();
            cmbApprovedBy.DisplayMember = "UserName";
            cmbApprovedBy.ValueMember   = "UserName";
        }
        private void FrmDetailPurchaseContract_Load(object sender, EventArgs e)
        {
            SellerMasterBL sellerMasterBL = new SellerMasterBL();

            cmbSeller.DataSource    = sellerMasterBL.GetSeller();
            cmbSeller.DisplayMember = "CompanyName";
            cmbSeller.ValueMember   = "ID";

            UserMasterBL userMasterBL = new UserMasterBL();

            cmbUserMaster.DataSource    = userMasterBL.GetUserMaster();
            cmbUserMaster.DisplayMember = "UserName";
            cmbUserMaster.ValueMember   = "UserName";

            cmbApprovedBy.DataSource    = userMasterBL.GetUserMaster();
            cmbApprovedBy.DisplayMember = "UserName";
            cmbApprovedBy.ValueMember   = "UserName";
        }
Пример #17
0
        public JsonResult SaveUpdateUser(UserMasterPOCO pOCO)
        {
            UserMasterBL   bL = new UserMasterBL();
            UserMasterPOCO pC = new UserMasterPOCO();

            pC.UserId     = pOCO.UserId;
            pC.RankId     = pOCO.RankId;
            pC.ShipId     = pOCO.ShipId;
            pC.UserName   = pOCO.UserName;
            pC.UserCode   = pOCO.UserCode;
            pC.Password   = pOCO.Password;
            pC.Email      = pOCO.Email;
            pC.CreatedBy  = pOCO.CreatedBy;
            pC.ModifiedBy = pOCO.ModifiedBy;
            pC.Gender     = pOCO.Gender;
            pC.VesselIMO  = pOCO.VesselIMO;
            pC.RoleType   = pOCO.RoleType;
            //pC.UserCode = pOCO.UserCode;
            pC.UserType = pOCO.UserType;
            //pC.IsAdmin      = pOCO.IsAdmin;

            return(Json(bL.SaveUpdateUser(pC), JsonRequestBehavior.AllowGet));
        }
Пример #18
0
        public JsonResult SaveUpdateSupportUser(UserMasterPOCO pOCO)
        {
            UserMasterBL   bL = new UserMasterBL();
            UserMasterPOCO pC = new UserMasterPOCO();

            pC.UserId = pOCO.UserId;

            pC.RankId     = pOCO.RankId;
            pC.ShipId     = pOCO.ShipId;
            pC.UserName   = pOCO.UserName;
            pC.Password   = pOCO.Password;
            pC.Email      = pOCO.Email;
            pC.CreatedBy  = pOCO.CreatedBy;
            pC.ModifiedBy = pOCO.ModifiedBy;
            pC.Gender     = pOCO.Gender;
            pC.VesselIMO  = pOCO.VesselIMO;

            //pC.UserCode = pOCO.UserCode;
            pC.UserType = 0;
            pC.IsAdmin  = pOCO.IsAdmin;

            return(Json(bL.SaveUpdateUser(pC /*, int.Parse(Session["VesselID"].ToString())*/), JsonRequestBehavior.AllowGet));
        }
Пример #19
0
        public void GetAllUser()
        {
            UserMasterBL     bL       = new UserMasterBL();
            List <GroupUser> pocoList = new List <GroupUser>();

            pocoList = bL.GetAllUser(/*int.Parse(Session["VesselID"].ToString())*/);
            List <GroupUser> itmasterList = new List <GroupUser>();

            foreach (GroupUser up in pocoList)
            {
                GroupUser unt = new GroupUser();
                unt.UserId   = up.UserId;
                unt.UserName = up.UserName;

                itmasterList.Add(unt);
            }

            ViewBag.Users = itmasterList.Select(x =>
                                                new SelectListItem()
            {
                Text  = x.UserName,
                Value = x.UserId.ToString()
            });
        }
Пример #20
0
        public ActionResult ForgotPassword(UserMasterPOCO aUserMaster)
        {
            bool isSendSuccessfully = false;

            try
            {
                UserMasterBL umBL          = new UserMasterBL();
                int          isValid       = 0;
                string       initialPwd    = "";
                string       userCode      = "";
                string       receiverEmail = aUserMaster.Email;
                isValid = umBL.ForgotPassword(aUserMaster, ref initialPwd, ref userCode);

                StringBuilder mailBody = new StringBuilder();

                if (isValid == 0)
                {
                    //return Json(isValid, JsonRequestBehavior.AllowGet);
                    aUserMaster.hasChange = 2;
                    return(View(aUserMaster));
                }
                else if (isValid == 1)
                {
                    aUserMaster.hasChange = 1;

                    #region send mail----

                    //receiverEmail = um.Email.ToString();

                    MailMessage mail = new MailMessage();

                    mailBody.Append("User Code : ");
                    mailBody.Append(userCode.ToString());
                    mailBody.Append("\n");
                    mailBody.Append("Initial Password : "******"\n");
                    mailBody.Append("\n");
                    mailBody.Append("Messege : ");
                    mailBody.Append("Login with above User Code and Password and Change your Password");
                    mailBody.Append("\n");
                    mail.Body = mailBody.ToString();


                    SendEmail.SendMail("TCC Request for Forgot Password", "", receiverEmail, mail, ref isSendSuccessfully);



                    #endregion

                    return(View(aUserMaster));
                }
                else
                {
                    //return RedirectToAction("Login", "Home");
                    return(new RedirectToRouteResult(new RouteValueDictionary(
                                                         new { action = "Login", controller = "Home" })));
                }
            }
            catch (Exception e)
            {
                return(RedirectToAction("Login", "Home"));
            }
        }
Пример #21
0
        public ActionResult Login(UserMasterPOCO user)
        {
            UserMasterBL   userMasterBL    = new UserMasterBL();
            HomeBL         homeBl          = new HomeBL();
            string         lsReturnMessage = "0";
            string         lsApprover      = "0"; // Added on 29th Jul 2021 @BK
            string         lsAllowSign     = "0"; // Added on 29th Jul 2021 @BK
            UserMasterPOCO lUser           = new UserMasterPOCO();

            lUser = homeBl.CheckUserLogin(user, ref lsReturnMessage);
            if (lsReturnMessage == "1")
            {
                string role = userMasterBL.GetRoleByUserId(lUser.UserId);
                if (!string.IsNullOrEmpty(role))
                {
                    System.Web.HttpContext.Current.Session["Role"] = role;
                }
                else
                {
                    return(Json(0, JsonRequestBehavior.AllowGet));
                }


                ////----------------------------------------------------------------------------------
                ///

                //_cache.Insert("VolMenuData", Server.MapPath("~/xmlMenu/" + "ALLVOLUMES.xml"));
                //_cache.Insert("ShipMenuData", Server.MapPath("~/xmlMenu/" + "ALLSHIPS1.xml"));


                ///---------------------------------------------------------------------------------
                ///



                Session["UserId"]          = lUser.UserId.ToString();
                Session["UserCode"]        = lUser.UserCode.ToString();
                Session["UserName"]        = lUser.UserName.ToString();
                Session["Email"]           = lUser.Email.ToString();
                Session["ShipId"]          = lUser.ShipId.ToString();
                Session["DashboardShipId"] = lUser.ShipId.ToString();
                Session["IsApprover"]      = lUser.IsApprover.ToString(); //Added on 29th Jul 2021 @BK
                lsApprover             = lUser.IsApprover.ToString();     //Added on 29th Jul 2021 @BK
                Session["IsAllowSign"] = lUser.IsAllowSign.ToString();    //Added on 29th Jul 2021 @BK
                lsAllowSign            = lUser.IsAllowSign.ToString();    //Added on 29th Jul 2021 @BK

                if (!string.IsNullOrEmpty(lUser.ShipName))
                {
                    Session["ShipName"] = lUser.ShipName.ToString();
                }
                else
                {
                    Session["ShipName"] = "";
                }

                if (!string.IsNullOrEmpty(lUser.VesselIMO))
                {
                    Session["VesselIMO"] = lUser.VesselIMO.ToString();
                }
                else
                {
                    Session["VesselIMO"] = "";
                }

                Session["UserType"] = lUser.UserType.ToString();
                //Session["IsAdmin"]      = lUser.IsAdmin.ToString();


                if (role == "OfficeAdmin" || role == "ShipAdmin")
                {
                    return(RedirectToAction("AdminDashboard", "Dashboard"));
                }
                else if (role == "OfficeUser")
                {
                    if (lsApprover == "1" && lsAllowSign == "0")
                    {
                        return(RedirectToAction("Index", "ApproverSign"));
                    }
                    else
                    {
                        return(RedirectToAction("UserDashboard", "Dashboard"));
                    }
                }
                else
                {
                    return(RedirectToAction("UserDashboard", "Dashboard"));
                }


                //return new RedirectToRouteResult(new RouteValueDictionary(
                //new { action = "UserDashboard", controller = "Dashboard" }));
            }
            else
            {
                return(Json(lsReturnMessage, JsonRequestBehavior.AllowGet));
            }
        }
        public void LoadUserMaster()
        {
            UserMasterBL userMaster = new UserMasterBL();

            dgvUserMaster.DataSource = userMaster.GetUserMaster();
        }