Ejemplo n.º 1
0
        // GET: Visitor/Visitor
        public ActionResult Index(int?LibraryID = 0)
        {
            LibraryModel        model       = new LibraryModel();
            List <LibraryModel> libraryList = new List <LibraryModel>();

            if (LibraryID.Value > 0)
            {
                library.LibraryID = LibraryID.Value;
                actionResult      = libraryAction.Library_Load(library);
                if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
                {
                    DataRow row = actionResult.dtResult.Rows[0];
                    model.LibraryID     = row["LibraryID"] != DBNull.Value ? Convert.ToInt32(row["LibraryID"]) : 0;
                    model.LibraryName   = row["LibraryName"] != DBNull.Value ? row["LibraryName"].ToString() : "";
                    model.FileExistence = row["FileExistence"] != DBNull.Value ? row["FileExistence"].ToString() : "";
                    model.FilePath      = row["FilePath"] != DBNull.Value ? row["FilePath"].ToString() : "";
                    model.FileTypeId    = row["FileTypeId"] != DBNull.Value ? Convert.ToInt32(row["FileTypeId"].ToString()) : 0;
                    model.FileType      = row["Name"] != DBNull.Value ? row["Name"].ToString() : "";
                }
            }
            actionResult = libraryAction.Library_Load(library);
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                libraryList = (from DataRow row in actionResult.dtResult.Rows
                               select new LibraryModel
                {
                    LibraryID = row["LibraryID"] != DBNull.Value ? Convert.ToInt32(row["LibraryID"]) : 0,
                    LibraryName = row["LibraryName"] != DBNull.Value ? row["LibraryName"].ToString() : "",
                    FileExistence = row["FileExistence"] != DBNull.Value ? row["FileExistence"].ToString() : "",
                    FilePath = row["FilePath"] != DBNull.Value ? row["FilePath"].ToString() : "",
                    FileTypeId = row["FileTypeId"] != DBNull.Value ? Convert.ToInt32(row["FileTypeId"].ToString()) : 0,
                    FileType = row["Name"] != DBNull.Value ? row["Name"].ToString() : "",
                }).ToList();
            }

            List <SelectListItem> fileTypeList = new List <SelectListItem>();

            CIMS.ActionLayer.Employee.EmployeeAction employeeAction = new CIMS.ActionLayer.Employee.EmployeeAction();
            actionResult = employeeAction.FileType_Load();
            if (actionResult.IsSuccess)
            {
                fileTypeList = (from DataRow row in actionResult.dtResult.Rows
                                select new SelectListItem
                {
                    Text = row["Name"] != DBNull.Value ? row["Name"].ToString() : "",
                    Value = row["FileTypeId"] != DBNull.Value ? row["FileTypeId"].ToString() : ""
                }).ToList();
            }
            ViewBag.FileTypeList = fileTypeList;
            model.LibraryList    = libraryList;
            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult Index()
        {
            CIMS.ActionLayer.Employee.EmployeeAction employeeAction = new CIMS.ActionLayer.Employee.EmployeeAction();
            CIMS.BaseLayer.Employee.EmployeeBase     employeeBase   = new CIMS.BaseLayer.Employee.EmployeeBase();
            List <EmployeeModel> employeeList = new List <EmployeeModel>();
            EmployeeModel        model        = new EmployeeModel();

            employeeBase.UserID = Convert.ToInt32(Session["UserId"]);
            employeeBase.RoleID = Convert.ToInt32(Session["RoleId"]);
            actionResult        = employeeAction.Employees_dashboard(employeeBase);
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                employeeList = (from DataRow row in actionResult.dtResult.Rows
                                select new EmployeeModel
                {
                    EmployeeID = row["EmployeeID"] != DBNull.Value ? Convert.ToInt32(row["EmployeeID"]) : 0,
                    FirstName = row["FirstName"] != DBNull.Value ? row["FirstName"].ToString() : "",
                    MiddleName = row["MiddleName"] != DBNull.Value ? row["MiddleName"].ToString() : "",
                    LastName = row["LastName"] != DBNull.Value ? row["LastName"].ToString() : "",
                    CreatedByUser = row["CreatedByUser"] != DBNull.Value ? row["CreatedByUser"].ToString() : "",
                    CreatedDate = row["CreatedDate"] != DBNull.Value ? row["CreatedDate"].ToString() : "",
                    TotalEmployees = row["TotalEmployees"] != DBNull.Value ? row["TotalEmployees"].ToString() : "",
                    FilePath = row["FilePath"] != DBNull.Value ? Convert.ToString(row["FilePath"]) : null
                }).ToList();
            }
            CIMS.ActionLayer.VisitorAction visitorAction = new CIMS.ActionLayer.VisitorAction();
            List <VisitorModel>            visitorList   = new List <VisitorModel>();
            VisitorModel visitorModel = new VisitorModel();

            actionResult = visitorAction.Visitor_dashboard();
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                visitorList = (from DataRow row in actionResult.dtResult.Rows
                               select new VisitorModel
                {
                    VisitorID = row["VisitorID"] != DBNull.Value ? Convert.ToInt32(row["VisitorID"]) : 0,
                    VisitorName = row["VisitorName"] != DBNull.Value ? row["VisitorName"].ToString() : "",
                    CreatedByUser = row["CreatedByUser"] != DBNull.Value ? row["CreatedByUser"].ToString() : "",
                    CreatedDate = row["CreatedDate"] != DBNull.Value ? row["CreatedDate"].ToString() : "",
                    TotalVisit = row["TotalVisit"] != DBNull.Value ? row["TotalVisit"].ToString() : "",
                    ImagePath = row["ImagePath"] != DBNull.Value ? row["ImagePath"].ToString() : ""
                }).ToList();
            }
            CIMS.ActionLayer.Subject.SubjectAction subjectAction = new CIMS.ActionLayer.Subject.SubjectAction();
            CIMS.BaseLayer.Subject.SubjectBase     subjectBase   = new CIMS.BaseLayer.Subject.SubjectBase();
            List <SubjectModel> subjectList  = new List <SubjectModel>();
            SubjectModel        subjectModel = new SubjectModel();

            subjectBase.CreatedBy = Convert.ToInt32(Session["UserId"]);
            subjectBase.RoleID    = Convert.ToInt32(Session["RoleId"]);
            actionResult          = subjectAction.Subject_dashboard(subjectBase);
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                subjectList = (from DataRow row in actionResult.dtResult.Rows
                               select new SubjectModel
                {
                    SubjectID = row["SubjectID"] != DBNull.Value ? Convert.ToInt32(row["SubjectID"]) : 0,
                    FirstName = row["FirstName"] != DBNull.Value ? row["FirstName"].ToString() : "",
                    MiddleName = row["MiddleName"] != DBNull.Value ? row["MiddleName"].ToString() : "",
                    LastName = row["LastName"] != DBNull.Value ? row["LastName"].ToString() : "",
                    CreatedByUser = row["CreatedByUser"] != DBNull.Value ? row["CreatedByUser"].ToString() : "",
                    ModifiedDate = row["ModifiedDate"] != DBNull.Value ? row["ModifiedDate"].ToString() : "",
                    TotalSubjects = row["TotalSubjects"] != DBNull.Value ? row["TotalSubjects"].ToString() : "",
                    FilePath = row["FilePath"] != DBNull.Value ? Convert.ToString(row["FilePath"]) : null
                }).ToList();
            }
            model.EmployeeList = employeeList;

            visitorModel.VisitorList = visitorList;
            model.visitorNewModel    = visitorModel;

            subjectModel.SubjectList = subjectList;
            model.subjectNewModel    = subjectModel;


            // dhaval

            DataTable dt = new DataTable();

            dt = getbackground("");

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_logo"].ToString().Length > 0)
            {
                ViewBag.Corporate_logo = dt.Rows[0]["Corporate_logo"].ToString();
            }
            else
            {
                ViewBag.Corporate_logo = "admin-logo.png";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Customer_logo"].ToString().Length > 0)
            {
                ViewBag.Customer_logo = dt.Rows[0]["Customer_logo"].ToString();
            }
            else
            {
                ViewBag.Customer_logo = "admin-logo.png";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_background"].ToString().Length > 0)
            {
                ViewBag.Corporate_background = dt.Rows[0]["Corporate_background"].ToString();
            }
            else
            {
                ViewBag.Corporate_background = "#f79646";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_back_type"].ToString().Length > 0)
            {
                ViewBag.Corporate_back_type = dt.Rows[0]["Corporate_back_type"].ToString();
            }
            else
            {
                ViewBag.Corporate_back_type = "palette";
            }


            // Employee

            var controller  = "Employees";
            var controller1 = "Subject";

            int  action = 0;
            bool status = false;

            int  action1 = 0;
            bool status1 = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"].ToString());
                string[] permission = CheckAdminPermissions.permission(controller, userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }

                permission = CheckAdminPermissions.permission(controller1, userId);


                if (permission != null)
                {
                    action1 = Convert.ToInt32(permission[1]);
                    status1 = Convert.ToBoolean(permission[0]);
                }
            }

            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"].ToString());
                string[] permission = CheckPermissions.permission(controller, userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }

                permission = CheckPermissions.permission(controller1, userId);


                if (permission != null)
                {
                    action1 = Convert.ToInt32(permission[1]);
                    status1 = Convert.ToBoolean(permission[0]);
                }
            }

            ViewBag.Action = action;
            ViewBag.Status = status;

            ViewBag.Action1 = action1;
            ViewBag.Status1 = status1;

            // Subject


            return(View(model));
        }