Beispiel #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["FromDate"]))
            {
                FromDate.Value = startDate = Request.QueryString["FromDate"];
            }

            if (!string.IsNullOrEmpty(Request.QueryString["ToDate"]))
            {
                ToDate.Value = endDate = Request.QueryString["ToDate"];
            }

            divResult.InnerHtml = "";
            divResult.Visible   = false;

            var branches = IBranchService.GetUtilizedBranches();

            BranchId.DataSource     = branches;
            BranchId.DataTextField  = "Code";
            BranchId.DataValueField = "Id";
            BranchId.DataBind();
            BranchId.Items.Insert(0, new ListItem()
            {
                Text = "All", Value = "0"
            });
            if (!string.IsNullOrEmpty(Request.QueryString["BranchId"]))
            {
                BranchId.SelectedValue = Request.QueryString["BranchId"];
            }

            if (!string.IsNullOrEmpty(Request.QueryString["IsClear"]) && Request.QueryString["IsClear"] == "1")
            {
                FromDate.Value         = ToDate.Value = startDate = endDate = string.Empty;
                BranchId.SelectedValue = "0";
            }
            if (datechecking())
            {
                Querys();
                List <StatisticModel> last5DaysCount = IBatchService.GetDaysCountbyDepartment(barChatQuery, 0, 0, true);

                if (last5DaysCount.Count == 0)
                {
                    divResult.InnerHtml = @"<div class='alert alert-block alert-danger fade in'><button data-dismiss='alert' class='close close-sm' type='button'>
                                                <i class='fa fa-times'></i>
                                                </button>
                                                <strong>Oh snap!</strong> No records found for the search criteria entered.</div>";
                    divResult.Visible   = true;
                }
                else
                {
                    dataBind(last5DaysCount);
                }
            }
        }
Beispiel #2
0
        protected void UpdateBranchList()
        {
            BranchDataSource.Select();
            BranchId.Items.Clear();
            BranchId.DataBind();
            if (BranchId.Items.Count == 2)
            {
                BranchId.SelectedIndex = 1;
            }
            var criteria = Session[SessionKey.EventFilter] as EventSearchCriteria;

            if (criteria != null)
            {
                DoFilter(criteria);
            }
        }
Beispiel #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["UserId"] != null)
            {
                Int32    UserId   = Convert.ToInt32(Session["UserId"].ToString());
                User     user     = IUserService.GetSingle(UserId);
                UserRole userRole = IUserRoleService.GetSingle(user.UserRoleId);
                if (user.BranchId != 0)
                {
                    BranchId.Disabled = true;
                    BranchId.Value    = user.BranchId.ToString();
                }
                List <Branch>   branches   = IBranchService.GetDataByPropertyName(nameof(Branch.CompanyId), "1", true, 0, 0, false);
                List <UserRole> adminRoles = IUserRoleService.GetDataByPropertyName(nameof(UserRole.UserTypeId), "6", true, 0, 0, false);
                if (userRole.Name == "HQ Admin")
                {
                    adminRoles = adminRoles.Where(x => x.Id > userRole.Id).ToList();
                }
                else if (userRole.Name == "Regional Admin")
                {
                    if (user.IsAll == 0)
                    {
                        List <BranchUser> userBranches = IBranchUserService.GetDataByFilter(" user_id = '" + user.Id + "' and status='1'", 0, 0, false);
                        branches = IBranchService.GetDataByFilter(" ID not in (" + String.Join(",", userBranches.Select(x => x.BranchId).ToArray()) + ")", 0, 0, false);
                    }
                    adminRoles = adminRoles.Where(x => x.Id > userRole.Id).ToList();
                }
                else if (userRole.Name == "Branch Admin")
                {
                    Branch        branch        = IBranchService.GetSingle(user.BranchId);
                    List <Branch> AdminBranches = new List <Branch>();
                    AdminBranches.Add(branch);
                    branches   = AdminBranches;
                    adminRoles = adminRoles.Where(x => x.Id > userRole.Id).ToList();
                }
                UserRoleId.DataSource     = adminRoles;
                UserRoleId.DataTextField  = "Name";
                UserRoleId.DataValueField = "Id";
                UserRoleId.DataBind();
                UserRoleId.Items.Insert(0, new ListItem {
                    Value = "", Text = "Select"
                });


                BranchId.DataSource     = branches;
                BranchId.DataTextField  = "Code";
                BranchId.DataValueField = "Id";
                BranchId.DataBind();
                BranchId.Items.Insert(0, new ListItem {
                    Value = "0", Text = "Select"
                });
            }

            string currentDateString = DateTime.Now.ToString("MM/dd/yyyy");

            CreatedBy.Value   = "0";
            UpdatedBy.Value   = "0";
            CreatedDate.Value = currentDateString;
            UpdatedDate.Value = currentDateString;



            ApiAuthToken.Attributes.Add("readonly", "readonly");

            string idString = Request.QueryString["id"];

            if (idString != null && idString != "")
            {
                int  id  = Convert.ToInt32(idString);
                User obj = IUserService.GetSingle(id);

                UserRoleId.Value   = obj.UserRoleId.ToString();
                Username.Value     = obj.Username;
                EmailId.Value      = obj.EmailId;
                MobileNumber.Value = obj.MobileNumber;

                Password.Value    = obj.Password;
                TransPwd.Value    = obj.TransPwd;
                UniqueKey.Value   = obj.UniqueKey;
                IsOnline.Value    = obj.IsOnline.ToString();
                IsActive.Value    = obj.IsActive.ToString();
                IsPrimary.Value   = obj.IsPrimary.ToString();
                RegisterIp.Value  = obj.RegisterIp.ToString();
                LastLoginOn.Value = obj.LastLoginOn == null?DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") : obj.LastLoginOn.Value.ToString("MM/dd/yyyy HH:mm:ss");

                LastLoginIp.Value  = obj.LastLoginIp.ToString();
                ApiAuthToken.Value = obj.ApiAuthToken;

                Id.Value          = obj.Id.ToString();
                Status.Value      = obj.Status.ToString();
                CreatedBy.Value   = obj.CreatedBy.ToString();
                CreatedDate.Value = obj.CreatedOn.ToString("MM/dd/yyyy HH:mm:ss");
                UpdatedBy.Value   = obj.UpdatedBy.ToString();
                UpdatedDate.Value = obj.UpdatedOn == null?DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss") : obj.UpdatedOn.Value.ToString("MM/dd/yyyy HH:mm:ss");

                CompanyId.Value    = "1";
                BranchId.Value     = obj.BranchId == 0 ? "0" : obj.BranchId.ToString();
                DepartmentId.Value = obj.DepartmentId == 0 ? "0" : obj.DepartmentId.ToString();
                IsAll.Value        = obj.IsAll.ToString();
            }
        }
Beispiel #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string currentDateString = DateTime.Now.ToString("MM/dd/yyyy");

            CreatedDate.Value = currentDateString;
            UpdatedDate.Value = currentDateString;

            List <Branch>   branches     = IBranchService.GetData(0, 0, false);
            List <ListItem> branchesList = new List <ListItem>();

            branches.ForEach(obj => {
                branchesList.Add(new ListItem()
                {
                    Text  = obj.Code + " - " + obj.Name,
                    Value = obj.Id.ToString()
                });
            });

            BranchId.DataSource     = branchesList;
            BranchId.DataTextField  = "Text";
            BranchId.DataValueField = "Value";
            BranchId.DataBind();

            List <Department> departments     = IDepartmentService.GetData(0, 0, false);
            List <ListItem>   departmentsList = new List <ListItem>();

            departments.ForEach(obj => {
                departmentsList.Add(new ListItem()
                {
                    Text  = obj.Code + " - " + obj.Name,
                    Value = obj.Id.ToString()
                });
            });

            DepartmentId.DataSource     = departmentsList;
            DepartmentId.DataTextField  = "Text";
            DepartmentId.DataValueField = "Value";
            DepartmentId.DataBind();

            List <Stage>    stages     = IStageService.GetData(0, 0, false);
            List <ListItem> stagesList = new List <ListItem>();

            stages.ForEach(obj => {
                stagesList.Add(new ListItem()
                {
                    Text  = obj.Code + " - " + obj.Name,
                    Value = obj.Id.ToString()
                });
            });

            StageId.DataSource     = stagesList;
            StageId.DataTextField  = "Text";
            StageId.DataValueField = "Value";
            StageId.DataBind();
            Status.Value = "1";
            string idString = Request.QueryString["id"];

            if (idString != null && idString != "")
            {
                int   id  = Convert.ToInt32(idString);
                Batch obj = IBatchService.GetSingle(id);
                Id.Value          = obj.Id.ToString();
                BranchId.Value    = obj.BranchId.ToString();
                StageId.Value     = obj.StageId.ToString();
                BatchKey.Value    = obj.BatchKey;
                BatchNo.Value     = obj.BatchNo;
                BatchCount.Value  = obj.BatchCount.Value.ToString();
                BatchStatus.Value = obj.BatchStatus.ToString();
                Status.Value      = obj.Status.ToString();
            }
        }