Exemplo n.º 1
0
        public ActionResult Permission(String User_ID)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;

                if (User_ID != null)
                {
                    String Dec_UserID = BAL.Security.URLDecrypt(User_ID);
                    if ((Dec_UserID != "0") && (Dec_UserID != null))
                    {
                        IEnumerable<DAL.SiteList> site = null;
                        try
                        {
                            UserInformation Userinfo = new UserInformation();
                            Userinfo.UserID = Convert.ToInt64(Dec_UserID);
                            ViewBag.UserName = Userinfo.GetUserName();
                            ViewBag.UserNumber = Userinfo.UserNumber();
                            if (Userinfo.UserType()==1)
                            {
                                Int64? ClientID = Userinfo.GetClientID();
                                if (Userinfo.GetClientID() != null)
                                {
                                    ViewBag.ClientName = Userinfo.GetClientName();
                                    if (Userinfo.ClientList().Count > 0)
                                    {
                                        String SelectClient = Userinfo.ClientList()[0].Value;
                                        ViewBag.ClinetID = SelectClient;
                                        Userinfo.SelectedClientID = Convert.ToInt64(SelectClient);
                                        ViewBag.ClientName = new SelectList(Userinfo.ClientList(), "Value", "Text", SelectClient);
                                       // site = BAL.SiteModel.SiteList(Convert.ToInt64(SelectClient));
                                        site = Userinfo.SiteList();

                                    }

                                }
                            }
                            else
                            {

                                if (Userinfo.ClientList().Count > 0)
                                {
                                    String SelectClient = Userinfo.ClientList()[0].Value;
                                    Userinfo.SelectedClientID = Convert.ToInt64(SelectClient);
                                    ViewBag.ClinetID = SelectClient;
                                    ViewBag.ClientName = new SelectList(Userinfo.ClientList(), "Value", "Text", SelectClient);
                                   // site = BAL.SiteModel.SiteList(Convert.ToInt64(SelectClient));
                                    site = Userinfo.SiteList();

                                }

                            }
                            return View(site);
                        }
                        catch (Exception ex)
                        { return Content(ex.Message); }
                      //  return View();
                    }
                }
                else
                {
                    if ((Request.QueryString["Client"] != null) && (Request.QueryString["hidUserID"] != null))
                    {

                        String ClientID = Request.QueryString["Client"].ToString();
                        String UserID = Request.QueryString["hidUserID"].ToString();
                        IEnumerable<DAL.SiteList> site = null;
                        UserInformation Userinfo = new UserInformation();
                        Userinfo.UserID = Convert.ToInt64(UserID);
                        ViewBag.UserName = Userinfo.GetUserName();
                        ViewBag.UserNumber = Userinfo.UserNumber();
                        if (Userinfo.UserType() ==1)
                        {
                            if (Userinfo.ClientList().Count > 0)
                            {
                                String SelectClient = ClientID;
                                ViewBag.ClinetID = SelectClient;
                                Userinfo.SelectedClientID = Convert.ToInt64(SelectClient);
                                ViewBag.ClientName = new SelectList(Userinfo.ClientList(), "Value", "Text", SelectClient);
                               // site = BAL.SiteModel.SiteList(Convert.ToInt64(SelectClient));
                                site = Userinfo.SiteList();
                                return View(site);
                            }

                        }

                    }

                }
                return View();
            }
            else
            {
                return RedirectToAction("Index", "Home");
            }
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;

                BAL.UserRegister objUserRegister = new BAL.UserRegister();
                ViewBag.Security = new SelectList(BAL.SecurityQuestion.SecurityQuestionDDR(), "Value", "Text");
                ViewBag.Role = new SelectList(BAL.RoleModels.RoleDDL(), "Value", "Text");
                UserInformation Userinfo = new UserInformation();
                Userinfo.UserID = Convert.ToInt64(loginsession.UserID);

                if (Userinfo.UserType()==1) //for others user
                {
                    Int64? ClientID = Userinfo.GetClientID();
                    if (Userinfo.GetClientID() != null)
                    {
                        String SelectClient = Userinfo.ClientList()[0].Value;
                        ViewBag.Client = new SelectList(Userinfo.ClientList(), "Value", "Text", SelectClient);

                        ViewBag.HiddenSycous = 1;//Userinfo.UserType();
                        objUserRegister.UserType = true;
                    }
                }
                if (Userinfo.UserType() == 0)
                { //for sycous user
                    ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text");

                    ViewBag.HiddenSycous = 0;// false;
                    objUserRegister.UserType = false;

                }
                //return View();
                return View(objUserRegister);
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
Exemplo n.º 3
0
        public ActionResult Edit(String User_ID)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];
                ViewBag.CompanyLogo = loginsession.CompanyLogo;
                ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                ViewBag.RoleName = loginsession.RoleName;

                if (User_ID != null)
                {
                    String Dec_UserID = BAL.Security.URLDecrypt(User_ID);
                    if ((Dec_UserID != "0") && (Dec_UserID != null))
                    {
                        UserRegister Registration = new UserRegister();
                        try
                        {
                            Registration = BAL.RegistrationModels.EditUserRegistration(Dec_UserID);
                            ViewBag.UserID = Registration.User_ID;

                            UserInformation Userinfo = new UserInformation();
                            Userinfo.UserID = Convert.ToInt64(loginsession.UserID);

                            if (Userinfo.UserType() == 1) //for others user
                            {

                                if (Registration.ClientID != null)
                                { ViewBag.Client = new SelectList(Userinfo.ClientList(), "Value", "Text", Registration.ClientID); }
                                else
                                {
                                            Int64? ClientID = Userinfo.GetClientID();
                                            if (Userinfo.GetClientID() != null)
                                            {
                                                String SelectClient = Userinfo.ClientList()[0].Value;
                                                ViewBag.Client = new SelectList(Userinfo.ClientList(), "Value", "Text", SelectClient);

                                                // objUserRegister.UserType = true;
                                            }
                                }
                                 ViewBag.HiddenSycous = "1";//Userinfo.UserType();
                            }
                            if (Userinfo.UserType() == 0)
                            { //for sycous user
                                if (Registration.ClientID != null)
                                {
                             ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text", Registration.ClientID);
                             //ViewBag.HiddenSycous = 0;
                                }
                                else
                                {
                             ViewBag.Client = new SelectList(BAL.ClientModel.ClientDropDownList(), "Value", "Text" );
                                }
                              ViewBag.HiddenSycous = "0";// false;
                               // objUserRegister.UserType = false;
                            }

                        }
                        catch (Exception ex)
                        { return Content(ex.Message); }

                        return View(Registration);
                    }
                }
                else
                {
                    return RedirectToAction("Index", "UserReg");
                }
                return View();
            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
Exemplo n.º 4
0
        //
        // GET: /UserReg/
        public ActionResult Index()
        {
            if (Session["Login"] != null)
            {
                IEnumerable<DAL.UserRegistrationDetails> reg = null;
                try
                {

                    LoginSession loginsession = (LoginSession)Session["Login"];
                    ViewBag.CompanyLogo = loginsession.CompanyLogo;
                    ViewBag.Layout1 = BAL.Common.LayoutType(loginsession.UserType);
                    String actionName = this.ControllerContext.RouteData.Values["action"].ToString();
                    String controllerName = this.ControllerContext.RouteData.Values["controller"].ToString();
                    ViewBag.Menu = BAL.Common.GetActiveMenu(controllerName, actionName, BAL.Common.LayoutType(loginsession.UserType));
                    ViewBag.RoleName = loginsession.RoleName;
                    UserInformation Userinfo = new UserInformation();
                    Userinfo.UserID = Convert.ToInt64(loginsession.UserID);
                    Int64? ClientID = Userinfo.GetClientID();

                    if ((Request.QueryString["Field"] != null) && (Request.QueryString["search"] != null))
                    {

                        String Field = Request.QueryString["Field"].ToString();
                        String value = Request.QueryString["search"].ToString();
                        ViewBag.searchField = new SelectList(BAL.RegistrationModels.SearchFieldDDList(), "Value", "Text", Field);
                        reg = BAL.RegistrationModels.UserRegistrationList(Field, value, ClientID.ToString());
                    }
                    else
                    {
                        ViewBag.searchField = new SelectList(BAL.RegistrationModels.SearchFieldDDList(), "Value", "Text");
                        reg = BAL.RegistrationModels.UserRegistrationList(ClientID.ToString());
                    }
                    return View(reg);
                }
                catch (Exception ex)
                {
                    throw;
                }

            }
            else
            { return RedirectToAction("Index", "Home"); }
        }
Exemplo n.º 5
0
        public String DeleteingPermission(String CLIENTID, String USERID)
        {
            if (Session["Login"] != null)
            {
                LoginSession loginsession = (LoginSession)Session["Login"];

                if ((CLIENTID != null) && (USERID != null) )
                {
                    UserInformation Userinfo = new UserInformation();
                    Userinfo.UserID = Convert.ToInt64(USERID);
                    Userinfo.SelectedClientID = Convert.ToInt64(CLIENTID);
                    Userinfo.ModifyBY = Convert.ToInt64(loginsession.UserID);
                    if (Userinfo.DeletedSite())
                    {
                        return "true";
                    }
                    else
                    {
                        return "false";
                    }
                }
                else
                { return "false"; }
            }
            else
            {
                RedirectToAction("Index", "Home");
                return "false";
            }
        }
Exemplo n.º 6
0
        public ActionResult InsertRecord(CorrespondenceNotesMaster model)
        {
            if (Session["Login"] != null)
             {
                 LoginSession loginsession = (LoginSession)Session["Login"];

                 //if (String.IsNullOrEmpty(model.Notes.ToString()))
                 //{
                 //    ModelState.AddModelError("Notes ", "Please Select  Date ");
                 //}

                 try
                 {
                     if (ModelState.IsValid)
                     {
                         SearchConsumer Consumerobj = new SearchConsumer();
                         Consumerobj.ClientID = model.ClientID;
                         Consumerobj.SiteID = model.SiteID;
                         Consumerobj.PropertyID = model.PropertyID;
                         Consumerobj.MeterID = model.MeterID;
                         Consumerobj.OwnerID = model.OwnerID;
                         Consumerobj.ConsumerID = model.ConsumerID;

                         UserInformation userinfo = new UserInformation();
                         userinfo.UserID = Convert.ToInt64(loginsession.UserID);
                         if (userinfo.GetUserFirstname() != null)
                         {
                             model.Author =  userinfo.GetUserFirstname();
                         }

                         model.CreateBy = Convert.ToInt64(loginsession.UserID);
                         if (BAL.CorrespondenceModel.CreateCorrespondenceNotes(model))
                         {
                             TempData["SearchParamList"] = Consumerobj;
                             return Json(new { result = 1, message = "Record was successfully Saved!" });
                         }
                         else
                         {
                             TempData["SearchParamList"] = Consumerobj;
                             return Json(new { result = 0, message = "Try again " });
                         }
                     }
                     else
                     {
                         String errorMessage = String.Empty;
                         String exception = String.Empty;
                         foreach (var modelStateVal in ViewData.ModelState.Values)
                         {
                             foreach (var error in modelStateVal.Errors)
                             {
                                 errorMessage = error.ErrorMessage;
                                 exception = error.Exception.ToString();
                             }
                         }
                         return Content("ErrorMessage" + ":" + exception);
                     }
                 }
                 catch (Exception ex)
                 { return Content("ErrorMessage" + ":" + ex.Message); }

             }
             else
             { return RedirectToAction("Index", "Home"); }
        }
Exemplo n.º 7
0
        public ActionResult CreateNotes(String pConsumerID, String pOwnerID, String ppropertyID, String pSiteID, String pClientID, String pMeterID)
        {
            if (Session["Login"] != null)
             {
                 try
                 {
                     LoginSession loginsession = (LoginSession)Session["Login"];
                     if ((pClientID != null) && (!String.IsNullOrEmpty(pClientID)) && (pSiteID != null) && (!String.IsNullOrEmpty(pSiteID)) && (ppropertyID != null) && (!String.IsNullOrEmpty(ppropertyID)) && (pConsumerID != null) && (!String.IsNullOrEmpty(pConsumerID)) && (pMeterID != null) && (!String.IsNullOrEmpty(pMeterID)) && (pMeterID != null) && (!String.IsNullOrEmpty(pMeterID)))
                     {
                         CorrespondenceNotesMaster corres = new CorrespondenceNotesMaster();
                         corres.ClientID = pClientID;
                         corres.SiteID = pSiteID;
                         corres.PropertyID = ppropertyID;
                         corres.MeterID = pMeterID;
                         corres.OwnerID = pOwnerID;
                         corres.ConsumerID = pConsumerID;
                         UserInformation userinfo = new UserInformation();
                         userinfo.UserID = Convert.ToInt64(loginsession.UserID);
                         if (userinfo.GetUserFirstname() != null)
                         {
                         corres.Author = userinfo.GetUserFirstname();
                         }

                         return PartialView("AddNotes", corres);
                     }
                     else { return Content(" Try Again"); }
                 }
                 catch (Exception ex)
                 { return Content("Error:" + ex.StackTrace.ToString()); }
             }
             else
             { return RedirectToAction("Index", "Home"); }
        }
Exemplo n.º 8
0
 public ActionResult _DispalyUser()
 {
     try
     {
         if (Session["Login"] != null)
         {
             LoginSession loginsession = (LoginSession)Session["Login"];
             UserInformation userinfo = new UserInformation();
             userinfo.UserID = Convert.ToInt64(loginsession.UserID);
             if (userinfo.GetUserFirstname() != null)
             {
                 ViewBag.UserName = userinfo.GetUserFirstname();
             }
             else
             { ViewBag.UserName = ""; }
         }
         else
         {
             return RedirectToAction("Index", "Home");
         }
     }
     catch (Exception ex)
     {
         return RedirectToAction("Index", "Home");
     }
     return PartialView();
 }
Exemplo n.º 9
0
        public Object EditRecord(Int64 Id)
        {
            UserRegister Registration = new UserRegister();
            try
            {
                UserREG _user = DAL.DALUserReg.EditUserRegistration(Convert.ToInt64(Id));

                Registration.User_ID = _user.UserID;

                if (_user.UserName != null)
                {
                    Registration.UserName = _user.UserName.Trim();
                }

                if (_user.FirstName != null)
                {
                    Registration.FirstName = _user.FirstName;
                }
                if (_user.LastName != null)
                {
                    Registration.LastName = _user.LastName;
                }
                if (_user.Email != null)
                {
                    Registration.Email = _user.Email.Trim();
                }
                if (_user.Mobile != null)
                {
                    Registration.Mobile = _user.Mobile.Trim();
                }
                if (_user.Phone != null)
                {
                    Registration.phone = _user.Phone.Trim();
                }

                if (_user.Photo != null)
                {
                    Registration.Photo = _user.Photo.Trim();
                }

                if (_user.UserType== 0)
                {
                    Registration.UserType = false;
                }
                if (_user.UserType == 1)
                {
                    Registration.UserType = true;
                }

                if (_user.HintQuestion!=null)
                {
                    Registration.HintQut = _user.HintQuestion;
                }

                if (_user.HintAns != null)
                {
                    Registration.HintAns = _user.HintAns;
                }

                if (_user.ClientID != null)
                {
                    Registration.ClientID = _user.ClientID;
                }

                UserInformation Us = new UserInformation();
                Us.UserID = _user.UserID;
                Registration.Client = Us.GetUSERClientName();
                Registration.RoleName = Us.GetRoleName();

            }//try
            catch (Exception ex)
            {
                throw;
            }
            return Registration;
        }