Exemple #1
0
        private void FillDepartment()
        {
            DepartmentListRequest departmentsRequest = new DepartmentListRequest();

            departmentsRequest.type = 0;
            ListResponse <Department> resp = _companyStructureService.ChildGetAll <Department>(departmentsRequest);

            if (!resp.Success)
            {
                Common.errorMessage(resp);
            }
            departmentStore.DataSource = resp.Items;
            departmentStore.DataBind();
        }
Exemple #2
0
        private List <Department> GetDepartments()
        {
            DepartmentListRequest departmentsRequest = new DepartmentListRequest();

            departmentsRequest.type = 0;

            ListResponse <Department> resp = _companyStructureService.ChildGetAll <Department>(departmentsRequest);

            if (!resp.Success)
            {
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", resp.ErrorCode) != null ? GetGlobalResourceObject("Errors", resp.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + resp.LogId : resp.Summary).Show();
                return(new List <Department>());
            }
            return(resp.Items);
        }
        private void FillDepartments()
        {
            DepartmentListRequest     branchesRequest = new DepartmentListRequest();
            ListResponse <Department> resp            = _companyStructureService.ChildGetAll <Department>(branchesRequest);

            if (!resp.Success)
            {
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", resp.ErrorCode) != null ? GetGlobalResourceObject("Errors", resp.ErrorCode).ToString() + "<br>Technical Error: " + resp.ErrorCode + "<br> Summary: " + resp.Summary : resp.Summary).Show();
            }
            if (resp.Items != null)
            {
                departmentStore.DataSource = resp.Items;
                departmentStore.DataBind();
            }
        }
Exemple #4
0
        public void FillDepartment()
        {
            DepartmentListRequest req = new DepartmentListRequest();

            req.type = 0;
            ListResponse <Department> response = _branchService.ChildGetAll <Department>(req);

            if (!response.Success)
            {
                X.Msg.Alert(Resources.Common.Error, GetGlobalResourceObject("Errors", response.ErrorCode) != null ? GetGlobalResourceObject("Errors", response.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + response.LogId : response.Summary).Show();
                return;
            }
            deStore.DataSource = response.Items;
            deStore.DataBind();
        }
        public DepartmentListResponse GetList(DepartmentListRequest request)
        {
            var tokenUrl = Urls.DepartmentList;
            var apiurl   = string.Format(tokenUrl, request.ACCESS_TOKEN, request.FetchChild, request.ParentId);

            var resultJson = RequestHelper.Get(apiurl);

            var rtn = JsonConvert.DeserializeObject <DepartmentListResponse>(resultJson);

            if (rtn.ErrCode != ErrCodeEnum.OK)
            {
                throw new ApiException(ApiCodeEnum.Error, rtn.ErrMsg);
            }

            return(rtn);
        }
Exemple #6
0
        private void FillDepartment()
        {
            DepartmentListRequest req = new DepartmentListRequest();

            req.type = 0;

            ListResponse <Department> response = _companyStructureRepository.ChildGetAll <Department>(req);

            if (!response.Success)
            {
                Common.errorMessage(response);
                departmentStore.DataSource = new List <Department>();
            }
            departmentStore.DataSource = response.Items;
            departmentStore.DataBind();
        }
Exemple #7
0
        private void FillParent()
        {
            DepartmentListRequest req = new DepartmentListRequest();

            req.type = 0;

            ListResponse <Department> response = _branchService.ChildGetAll <Department>(req);

            if (!response.Success)
            {
                Common.errorMessage(response);
                departmentStore.DataSource = new List <Department>();
            }
            departmentStore.DataSource = response.Items;
            departmentStore.DataBind();
        }
        protected void FillHirarichy(object sender, DirectEventArgs e)
        {
            DepartmentListRequest req = new DepartmentListRequest();

            req.type       = Convert.ToInt32(type.SelectedItem.Value);
            req.isInactive = 1;
            ListResponse <Department> response = _companyStructureService.ChildGetAll <Department>(req);

            if (!response.Success)
            {
                X.MessageBox.ButtonText.Ok = Resources.Common.Ok;
                X.Msg.Alert(Resources.Common.ErrorUpdatingRecord, GetGlobalResourceObject("Errors", response.ErrorCode) != null ? GetGlobalResourceObject("Errors", response.ErrorCode).ToString() + "<br>" + GetGlobalResourceObject("Errors", "ErrorLogId") + response.LogId : response.Summary).Show();
                return;
            }

            X.Call("Init", GetDeptsJson(response.Items));
        }
Exemple #9
0
        private void FillDepartment()
        {
            if (!EnableDepartment)
            {
                return;
            }

            DepartmentListRequest departmentsRequest = new DepartmentListRequest();

            departmentsRequest.type = 0;
            ListResponse <Department> resp = _companyStructureService.ChildGetAll <Department>(departmentsRequest);

            if (!resp.Success)
            {
                Common.errorMessage(resp);
            }
            departmentStore.DataSource = resp.Items;
            departmentStore.DataBind();
            if (_systemService.SessionHelper.CheckIfIsAdmin())
            {
                return;
            }
            UserDataRecordRequest ud = new UserDataRecordRequest();

            ud.UserId   = _systemService.SessionHelper.GetCurrentUserId();
            ud.RecordID = "0";
            ud.classId  = ((ClassIdentifier)typeof(Department).GetCustomAttributes(true).Where(t => t is ClassIdentifier).ToList()[0]).ClassID;
            RecordResponse <UserDataAccess> udR = _accessControlService.ChildGetRecord <UserDataAccess>(ud);

            if (udR.result == null || !udR.result.hasAccess)
            {
                if (defaultDepartmentId == null)
                {
                    departmentId.Select(0);

                    departmentId.SetValue(resp.Items.Count != 0 ? resp.Items[0].recordId : null);
                }
                else
                {
                    departmentId.Select(defaultDepartmentId);

                    departmentId.SetValue(defaultDepartmentId);
                }
                X.Call("setDepartmentAllowBlank", true);
            }
        }
Exemple #10
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!X.IsAjaxRequest && !IsPostBack)
            {
                SetExtLanguage();
                HideShowButtons();
                HideShowColumns();

                DepartmentListRequest alldeptsreq = new DepartmentListRequest();
                ListResponse <Model.Company.Structure.Department> alldepts = _companyStructureService.ChildGetAll <Model.Company.Structure.Department>(alldeptsreq);
                if (!alldepts.Success)
                {
                    Common.errorMessage(alldepts);
                    return;
                }
                List <AdminDepartment> all = new List <AdminDepartment>();
                alldepts.Items.ForEach(x => all.Add(new AdminDepartment()
                {
                    departmentId = x.recordId, departmentName = x.name
                }));
                departmentStore.DataSource = all;
                departmentStore.DataBind();
                this.departmentSelector.SelectedItems.Clear();

                ListRequest req = new ListRequest();
                ListResponse <AdminDepartment> resp = _administrationService.ChildGetAll <AdminDepartment>(req);
                if (!resp.Success)
                {
                    Common.errorMessage(resp);
                    return;
                }

                resp.Items.ForEach(x =>
                {
                    this.departmentSelector.SelectedItems.Add(new Ext.Net.ListItem()
                    {
                        Value = x.departmentId
                    });
                });


                this.departmentSelector.UpdateSelectedItems();
            }
        }
Exemple #11
0
        protected void Store1_RefreshData(object sender, StoreReadDataEventArgs e)
        {
            //GEtting the filter from the page
            string filter     = string.Empty;
            int    totalCount = 1;



            //Fetching the corresponding list

            //in this test will take a list of News
            DepartmentListRequest request = new DepartmentListRequest();

            request.Filter     = searchTrigger.Text;
            request.type       = 0;
            request.isInactive = 0;
            request.Size       = e.Limit.ToString();
            request.StartAt    = e.Start.ToString();
            ListResponse <Department> branches = _branchService.ChildGetAll <Department>(request);

            branches.Items.ForEach(x =>
            {
                if (x.activeStatus == (Int16)ActiveStatus.ACTIVE)
                {
                    x.isInactive = false;
                }
                else
                {
                    x.isInactive = true;
                }
            });
            if (!branches.Success)
            {
                Common.errorMessage(branches);
                return;
            }
            this.Store1.DataSource = branches.Items;
            e.Total = branches.count;

            this.Store1.DataBind();
        }
Exemple #12
0
        public object FillParent(string action, Dictionary <string, object> extraParams)
        {
            StoreRequestParameters prms = new StoreRequestParameters(extraParams);



            List <Department>     data;
            DepartmentListRequest req = new DepartmentListRequest();

            req.type = 0;

            ListResponse <Department> response = _branchService.ChildGetAll <Department>(req);

            if (!response.Success)
            {
                Common.errorMessage(response);
                return(new List <Department>());
            }
            data = response.Items;
            return(new
            {
                data
            });
        }
 public DepartmentListResponse GetList(DepartmentListRequest request)
 {
     return(_departmentAppService.GetList(request));
 }
 public void GetDepartmentList()
 {
     DepartmentListRequest request = new DepartmentListRequest();
     request.id = 0;
     request.pid = 0;
     this.connection.Send(PacketType.DEPARTMENT_LIST, request);
 }