Example #1
0
        public string DeleteOrganizationAccount(int accID)
        {
            string strResponse = string.Empty;

            try
            {
                if (ModelState.IsValid)
                {
                    var Org = new OrganizationAccountComponent();
                    int r   = Org.DeleteOrganizationAccount(accID);
                    if (r > 0)
                    {
                        strResponse = "Account deleted successfully";
                    }
                    else if (r == 0)
                    {
                        strResponse = "Account does not exists";
                    }
                    else if (r < 0)
                    {
                        strResponse = "Error occured in DeleteOrganizationAccount";
                    }
                }
            }
            catch (Exception ex)
            {
                return(strResponse);
            }
            return(strResponse);
        }
Example #2
0
        public ActionResult showAllRecords()
        {
            List <OrganizationAccountEntity> AccDetails     = null;
            OrganizationAccountEntity        currentAccount = new OrganizationAccountEntity();

            try
            {
                if (ViewBag.currentRecord != null)
                {
                    currentAccount        = ViewBag.currentRecord;
                    ViewBag.currentRecord = null;
                }
                else
                {
                    var objDtl = new OrganizationAccountComponent();
                    AccDetails     = objDtl.GetOrganizationAccounts();
                    currentAccount = AccDetails.FirstOrDefault();
                }
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(View(currentAccount));
        }
Example #3
0
        public string ChangeStatus(string id, string status)
        {
            string strResponse = string.Empty;
            var    objDtl      = new OrganizationAccountComponent();

            strResponse = objDtl.ChangeStatus(id, status);

            return(strResponse);
        }
Example #4
0
        public JsonResult GetOrganizationAccountByID(int catID)
        {
            OrganizationAccountEntity AccDetails = null;

            try
            {
                var objDtl = new OrganizationAccountComponent();
                AccDetails = objDtl.GetOrganizationAccountByID(catID);
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(AccDetails, JsonRequestBehavior.AllowGet));
        }
Example #5
0
        public JsonResult GetOrganizationAccountCollection()
        {
            List <OrganizationAccountEntity> AccDetails = null;

            try
            {
                var objDtl = new OrganizationAccountComponent();
                AccDetails            = objDtl.GetOrganizationAccounts();
                ViewBag.OrgAccDetails = AccDetails[0].Acc_Version;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(AccDetails, JsonRequestBehavior.AllowGet));
        }
Example #6
0
        public ActionResult BrowseAccountRecords(int id, string navigation)
        {
            OrganizationAccountEntity currentRecord = null;

            try
            {
                var objDtl = new OrganizationAccountComponent();
                currentRecord         = objDtl.BrowseAccountRecords(id, navigation);
                ViewBag.currentRecord = currentRecord;
            }
            catch (Exception ex)
            {
                return(null);
            }

            return(View("showAllRecords"));
        }
Example #7
0
        public JsonResult GetOrganizationHistoryAccountByID(int catID)
        {
            List <HistoryOrganizationAccountEntity> HisAccDetails = null;

            try
            {
                var objDtl = new OrganizationAccountComponent();
                HisAccDetails = objDtl.GetOrganizationHistoryAccountsByID(catID);
                //ViewBag.OrgAccDetails = HisAccDetails[0].History_Acc_Version;
                ViewBag.OrgAccDetails = HisAccDetails;
            }
            catch (Exception ex)
            {
                return(null);
            }
            return(Json(HisAccDetails, JsonRequestBehavior.AllowGet));
        }
Example #8
0
        public string UpdateOrganizationAccount(OrganizationAccountEntity accdtl)
        {
            string          fileExtension  = string.Empty;
            var             orgcomponent   = new OrganizationAccountComponent();
            UserSessionInfo objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
            int             _userID        = objSessioninfo.UserId;

            accdtl.Acc_ModifiedBy = _userID;
            string imagename = string.Empty;

            #region MyRegion
            //if (accdtl.imgCropped != "undefined")
            //{
            //    byte[] bytes = Convert.FromBase64String(accdtl.imgCropped.Split(',')[1]);
            //    string sourceFile = "";
            //    string filePath = String.Empty;
            //    string base64 = accdtl.imgCropped;
            //    filePath = "/uploadimages/Images/thumb/" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
            //    sourceFile = filePath.Replace("/uploadimages/Images/thumb/", "").ToString();
            //    using (FileStream stream = new FileStream(Server.MapPath(filePath), FileMode.Create))
            //    {
            //        stream.Write(bytes, 0, bytes.Length);
            //        stream.Flush();
            //    }
            //    string physicalPath = Server.MapPath("/uploadimages/Images/thumb/" + sourceFile);

            //    imagename = sourceFile;
            //    accdtl.Acc_CompanyLogo = imagename;
            //}
            //else if (Request.Files.Count > 0)
            //{


            //    var file = Request.Files[0];
            //    //if (file != null)
            //    //{
            //        var fileName = "/uploadimages/Images/thumb/" + file.FileName;
            //        imagename = file.FileName;
            //        var imagepath = Server.MapPath(fileName);
            //        file.SaveAs(imagepath);
            //    //}
            //    //else
            //    //{
            //    //    imagename = accdtl.Acc_CompanyLogo;
            //    //}

            //    //  UploadImage.Crop(240,180, file.InputStream, Path.Combine(Server.MapPath("~/uploadimages/Images/thumb/") + file.FileName));
            //    //UploadImage.Crop(100, 100, file.InputStream, Path.Combine(Server.MapPath("~/uploadimages/images/thumb/") + file.FileName));
            //}

            //else
            //{
            //    accdtl.Acc_CompanyLogo = "User.png";

            //}
            #endregion

            if (accdtl.Acc_CompanyLogo == "undefined")
            {
                accdtl.Acc_CompanyLogo = "User.png";
            }
            else if (accdtl.imgCropped != "undefined")
            {
                byte[] bytes      = Convert.FromBase64String(accdtl.imgCropped.Split(',')[1]);
                string sourceFile = "";
                string filePath   = String.Empty;
                string base64     = accdtl.imgCropped;
                filePath   = "/uploadimages/Images/thumb/" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                sourceFile = filePath.Replace("/uploadimages/Images/thumb/", "").ToString();
                using (FileStream stream = new FileStream(Server.MapPath(filePath), FileMode.Create))
                {
                    stream.Write(bytes, 0, bytes.Length);
                    stream.Flush();
                }
                string physicalPath = Server.MapPath("/uploadimages/Images/thumb/" + sourceFile);
                var    path         = Path.Combine(Server.MapPath("~" + @"\upload\topic\"), sourceFile);
                fileExtension          = Path.GetExtension(path).ToLower();
                imagename              = sourceFile;
                accdtl.Acc_CompanyLogo = imagename;
            }
            else if (Request.Files.Count > 0)
            {
                var file     = Request.Files[0];
                var fileName = "/uploadimages/images/thumb/" + file.FileName;
                imagename = file.FileName;
                var imagepath = Server.MapPath(fileName);
                file.SaveAs(imagepath);
                //UploadImage.Crop(100, 100, file.InputStream, Path.Combine(Server.MapPath("~/uploadimages/images/thumb/") + file.FileName));
            }

            else
            {
                imagename = accdtl.Acc_CompanyLogo;
            }

            accdtl.Acc_CompanyLogo = imagename;
            string response = orgcomponent.UpdateOrganizationAccount(accdtl);
            return(response);
        }
Example #9
0
        public string CreateOrganizationAccount(OrganizationAccountEntity AccDtl)
        {
            string          strResponse    = string.Empty;
            string          fileExtension  = string.Empty;
            var             orgcomponent   = new OrganizationAccountComponent();
            string          imgcrop        = AccDtl.imgCropped;
            UserSessionInfo objSessioninfo = Session["UserSessionInfo"] as UserSessionInfo;
            int             _userID        = objSessioninfo.UserId;

            AccDtl.Acc_CreatedBy = _userID;
            string imagename = string.Empty;

            if (AccDtl.Acc_CompanyLogo == "undefined")
            {
                AccDtl.Acc_CompanyLogo = "User.png";
            }
            else if (AccDtl.imgCropped != "undefined")
            {
                byte[] bytes      = Convert.FromBase64String(AccDtl.imgCropped.Split(',')[1]);
                string sourceFile = "";
                string filePath   = String.Empty;
                string base64     = AccDtl.imgCropped;
                filePath   = "/uploadimages/Images/thumb/" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".png";
                sourceFile = filePath.Replace("/uploadimages/Images/thumb/", "").ToString();
                using (FileStream stream = new FileStream(Server.MapPath(filePath), FileMode.Create))
                {
                    stream.Write(bytes, 0, bytes.Length);
                    stream.Flush();
                }
                string physicalPath = Server.MapPath("/uploadimages/Images/thumb/" + sourceFile);
                var    path         = Path.Combine(Server.MapPath("~" + @"\upload\topic\"), sourceFile);
                fileExtension          = Path.GetExtension(path).ToLower();
                imagename              = sourceFile;
                AccDtl.Acc_CompanyLogo = imagename;
            }
            else if (Request.Files.Count > 0)
            {
                var file     = Request.Files[0];
                var fileName = "/uploadimages/images/thumb/" + file.FileName;
                imagename = file.FileName;
                var imagepath = Server.MapPath(fileName);
                file.SaveAs(imagepath);
                //UploadImage.Crop(100, 100, file.InputStream, Path.Combine(Server.MapPath("~/uploadimages/images/thumb/") + file.FileName));
            }
            if (imagename == "")
            {
                AccDtl.Acc_CompanyLogo = "User.png";
            }
            else
            {
                AccDtl.Acc_CompanyLogo = imagename;
            }

            #region MyRegion
            //string imagename = string.Empty;
            //string base64 = AccDtl.imgCropped;
            // if (Request.Files.Count > 0)
            //{
            //    var file = Request.Files[0];
            //    var fileName = "/uploadimages/images/" + file.FileName;
            //    imagename = file.FileName;
            //    var imagepath = Server.MapPath(fileName);
            //    file.SaveAs(imagepath);
            //    UploadImage.Crop(100, 100, file.InputStream, Path.Combine(Server.MapPath("~/uploadimages/images/thumb/") + file.FileName));
            //  //  UploadImage.Crop( 240,180, file.InputStream, Path.Combine(Server.MapPath("~/uploadimages/Images/thumb/") + file.FileName));
            //}
            //if (imagename == "")
            //{
            //    AccDtl.Acc_CompanyLogo = "User.png";
            //}
            //else
            //{
            //    AccDtl.Acc_CompanyLogo = imagename;
            //}
            #endregion

            int r = orgcomponent.AddOrganizationAccount(AccDtl);
            if (r == 1)
            {
                strResponse = "Account created successfully";
            }
            else if (r == 0)
            {
                strResponse = "Account already exists";
            }
            else if (r == -1)
            {
                strResponse = "Please Fill Mandatory Fields";
            }
            else if (r == 2)
            {
                strResponse = "AccountName already exists";
            }
            else if (r == 3)
            {
                strResponse = "AccountCode already exists";
            }
            //else if (r == 4)
            //{
            //    strResponse = "AccountCode already exists";
            //}
            return(strResponse);
        }
Example #10
0
        //UserSessionInfo objSessioninfo = new UserSessionInfo();

        public ActionResult Index(bool?pdf)
        {
            var RoleComponent = new RoleComponent();

            HomeController hm  = new HomeController();
            var            obj = hm.GetAdminMenu();


            var mk = "read";

            foreach (var item in obj)
            {
                //if (item.ModuleAccessType == "Read")
                //{
                //    var mk = item.ModuleAccessType;


                //    ViewBag.a = mk;

                //}
                if (item.ModuleName == "Add Role")
                {
                    mk = item.ModuleAccessType;


                    ViewBag.a = mk;
                }
            }
            if (!pdf.HasValue)
            {
                #region to return RoleList

                //objSessioninfo.UserId = 501;
                //Session["UserSessionInfo"] = objSessioninfo;
                UserSessionInfo info      = new UserSessionInfo();
                var             rolename  = info.RoleName;
                int             userid    = info.UserId;
                int             accountId = info.AccountId;
                string          RoleId    = info.RoleName;
                ViewBag.accid = accountId;
                var orgcomponent = new OrganizationAccountComponent();
                List <LookupStatusDetail> objStatusList = new List <LookupStatusDetail>();
                objStatusList.Add(new LookupStatusDetail {
                    StatusID = 1, Status = "Active"
                });
                objStatusList.Add(new LookupStatusDetail {
                    StatusID = 0, Status = "InActive"
                });

                var objStList = from cl in objStatusList
                                orderby cl.StatusID
                                select new
                {
                    value = cl.StatusID,
                    text  = cl.Status
                };
                ViewBag.Status = objStList;

                var modules = RoleComponent.Getallmodules();
                ViewBag.modules = modules;
                ViewBag.Roleid  = info.RoleName;
                var access = RoleComponent.Getallaccess();
                ViewBag.access = access;
                var objDtl = new UserComponent();
                LeaveSchemeComponent compobj = new LeaveSchemeComponent();
                var AccountNames             = compobj.GetallAccountnames(accountId, RoleId).Select(a => new SelectListItem()
                {
                    Value = a.Acc_AccountID.ToString(),
                    Text  = a.Acc_AccountName,
                });

                ViewBag.accountnames = AccountNames;
                var rolenames = orgcomponent.Getrolenames(rolename).Select(a => new SelectListItem()
                {
                    Value = a.GenericRoleID.ToString(),
                    Text  = a.Title,
                });
                ViewBag.rolenames = rolenames;
                return(View());

                #endregion
            }
            else
            {
                UserSessionInfo info     = new UserSessionInfo();
                var             rolename = info.RoleName;
                ViewBag.Roleid = info.RoleName;
                int    accountid = info.AccountId;
                string filename  = "Role.pdf";
                string filePath  = Server.MapPath("~/Content/PDFs/" + filename);

                var objDtl = new RoleComponent();
                IList <RoleEntity> RoleList = objDtl.GetRoleDetail(accountid, rolename);

                //ExportPDF(RoleList, new string[] { "Rol_RoleID", "AccountName", "Rol_RoleCode", "Rol_RoleName", "Rol_RoleDescription" }, filePath);

                return(File(filePath, "application/pdf"));
            }
        }