示例#1
0
        private void LoadServiceCategoryJob()
        {
            if (request != null)
            {
                ServiceCategoryJobPresenter serviceCatJobPresenter = new ServiceCategoryJobPresenter();

                var serviceCatJob = serviceCatJobPresenter.GetCompleteServiceCategoryJob(request.Servicecategoryjobid.Value);

                if (serviceCatJob != null)
                {
                    txtUserRequest.Text = serviceCatJob.GetFullName();
                    txtUserRequest.Tag  = serviceCatJob;
                }
                if (request.Finalservicecategoryjobid.HasValue)
                {
                    var finalServiceCatJob = serviceCatJobPresenter.GetCompleteServiceCategoryJob(request.Finalservicecategoryjobid.Value);
                    if (finalServiceCatJob != null)
                    {
                        txtFinalRequest.Text = finalServiceCatJob.GetFullName();
                        txtFinalRequest.Tag  = finalServiceCatJob;
                    }
                }
            }
        }
        public UCRequestEntry(TransMode tMode, SdUserRequestDto request, UserInformation userInfo)
        {
            this.userInfo = userInfo;
            InitializeComponent();
            this.userRequest = request;
            this.tMode       = tMode;
            this.userInfo    = userInfo;
            if (tMode == TransMode.ViewRecord || tMode == TransMode.EditRecord)
            {
                UserRequestPresenter        requestPresenter       = new UserRequestPresenter();
                BaseDataServicePresenter    baseDataPresenter      = new BaseDataServicePresenter();
                ServiceCategoryJobPresenter serviceCatJobPresenter = new ServiceCategoryJobPresenter();


                var creatorPers = baseDataPresenter.getPersonel(request.Createuserid.Value);
                txtRequester.Text = creatorPers.FullName;
                if (userRequest.Owneruserid.HasValue)
                {
                    var ownerUser = baseDataPresenter.getPersonel(request.Owneruserid.Value);
                    txtOwnername.Text = ownerUser.FullName;
                }


                if (request.Createdate != null)
                {
                    dtpDate.Value = request.Createdate.Value;
                }
                var serviceCatJob = serviceCatJobPresenter.GetCompleteServiceCategoryJob(request.Servicecategoryjobid.Value);

                lstJobs.DataSource = new List <string>()
                {
                    serviceCatJob.ServiceJob.Title
                };

                treeServices.Nodes.Add(serviceCatJob.ServiceCategory.Title);



                txtDescription.Text = userRequest.Description;
                if (userRequest.Creditdate.HasValue)
                {
                    dtpCreditDate.Value = userRequest.Creditdate.Value;
                }



                if (serviceCatJob.ServiceCategory.HasMenus)
                {
                }

                txtContact.Text = userRequest.Callnumber;

                if (serviceCatJob.HasAttachments)
                {
                    var attachments = requestPresenter.GetRequestAttachments(userRequest.SerReqId);

                    attachBs.DataSource  = attachBlist;
                    igridAtch.DataSource = attachBs;
                    foreach (var item in attachments)
                    {
                        attachBs.Add(item);
                    }
                }
                person = myView.baseDataPresenter.getPersonel(userRequest.Owneruserid ?? 0);
                if (serviceCatJob.ServiceCategory.HasDevices)
                {
                    var device = baseDataPresenter.GetDevice(userRequest.Transferid ?? 0);

                    if (device != null)
                    {
                        PersonDevice pd = new PersonDevice(device, person);
                        igridDeviceList.DataSource = new List <PersonDevice>()
                        {
                            pd
                        };
                    }
                }

                btnCreateRequest.Visible = false;
                txtContact.ReadOnly      = true;
                txtDescription.ReadOnly  = true;
                txtMenu.ReadOnly         = true;
                txtRequester.ReadOnly    = true;
                btnMInAtc.Enabled        = false;
                btnSelectAttch.Enabled   = false;
                btnSelectMenu.Enabled    = false;
                if (tMode == TransMode.ViewRecord)
                {
                    btnSelectOwner.Enabled = false;
                }
                igridDeviceList.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False;
                LoadAttachment(request.SerReqId);
                igridAtch.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False;
            }
            SetGrid();
        }
        private void SetUI(SdUserRequestDto _userRequest)
        {
            ServiceCategoryJobPresenter serviceCatJobPresenter = new ServiceCategoryJobPresenter();
            BaseDataServicePresenter    baseDataPresenter      = new BaseDataServicePresenter();

            if (userRequest != null)
            {
                numUpDownPriority.Value = userRequest.Priority ?? 0;
                var serviceCatJob = serviceCatJobPresenter.GetCompleteServiceCategoryJob(userRequest.Servicecategoryjobid.Value);
                if (serviceCatJob != null)
                {
                    txtUserRequest.Text = serviceCatJob.GetFullName();
                    txtUserRequest.Tag  = serviceCatJob;
                }
                if (userRequest.Finalservicecategoryjobid.HasValue)
                {
                    var finalserviceCatJob = serviceCatJobPresenter.GetCompleteServiceCategoryJob(userRequest.Finalservicecategoryjobid.Value);
                    if (finalserviceCatJob != null)
                    {
                        txtFinalRequest.Text = finalserviceCatJob.GetFullName();
                        txtFinalRequest.Tag  = finalserviceCatJob;
                    }
                }
                if (userRequest.Createuserid.HasValue)
                {
                    var creatorUser = baseDataPresenter.getPersonel(userRequest.Createuserid.Value);
                    txtRequester.Text = creatorUser.FullName;
                }
                if (userRequest.Owneruserid.HasValue)
                {
                    var ownerUser = baseDataPresenter.getPersonel(userRequest.Owneruserid.Value);
                    txtOwnername.Text = ownerUser.FullName;
                }
                if (serviceCatJob.HasAttachments)
                {
                    var attachments = requestPresenter.GetRequestAttachments(userRequest.SerReqId);

                    attachBs.DataSource  = attachBlist;
                    igridAtch.DataSource = attachBs;
                    foreach (var item in attachments)
                    {
                        attachBs.Add(item);
                    }
                }
                person = myView.baseDataPresenter.getPersonel(userRequest.Owneruserid ?? 0);
                if (serviceCatJob.ServiceCategory.HasDevices)
                {
                    var device = baseDataPresenter.GetDevice(userRequest.Transferid ?? 0);

                    if (device != null)
                    {
                        PersonDevice pd = new PersonDevice(device, person);
                        igridDeviceList.DataSource = new List <PersonDevice>()
                        {
                            pd
                        };
                    }
                }
                else
                {
                    grpDeviceList.Visible = false;
                }
                txtDescription.Text = userRequest.Description;
                if (userRequest.Creditdate.HasValue)
                {
                    dtpCreditDate.Value = userRequest.Creditdate.Value;
                }


                txtContact.Text = userRequest.Callnumber;
            }
        }
        public UCRequestEntry(TransMode tMode, ISE.Cartable.DE.CartableDataSet.MY_CARTABLE_FOR_SERVICE_DESKRow row, UserInformation userInfo)
        {
            this.userInfo = userInfo;
            InitializeComponent();
            servieDeskRow = row;
            this.tMode    = tMode;
            this.userInfo = userInfo;
            if (tMode == TransMode.ViewRecord || tMode == TransMode.EditRecord)
            {
                UserRequestPresenter        requestPresenter       = new UserRequestPresenter();
                BaseDataServicePresenter    baseDataPresenter      = new BaseDataServicePresenter();
                ServiceCategoryJobPresenter serviceCatJobPresenter = new ServiceCategoryJobPresenter();


                treeServices.Visible = false;
                lstJobs.Visible      = false;
                txtRequester.Text    = row.PERSONELNAME;


                if (row.IsCREATEDATENull() == false)
                {
                    dtpDate.Value = row.CREATEDATE;
                }


                lstJobs.DataSource = new List <string>()
                {
                    row.SERVICEJOB
                };

                treeServices.Nodes.Add(row.SERVICECATEGORY);

                userRequest = requestPresenter.GetRequest(row.SER_REQ_ID);
                if (userRequest.Owneruserid.HasValue)
                {
                    var ownerUser = baseDataPresenter.getPersonel(userRequest.Owneruserid.Value);
                    txtOwnername.Text = ownerUser.FullName;
                }
                txtDescription.Text = userRequest.Description;
                if (userRequest.Creditdate.HasValue)
                {
                    dtpCreditDate.Value = userRequest.Creditdate.Value;
                }

                var serviceCatJob = serviceCatJobPresenter.GetCompleteServiceCategoryJob(userRequest.Servicecategoryjobid.Value);

                if (serviceCatJob.ServiceCategory.HasMenus)
                {
                }

                txtContact.Text = userRequest.Callnumber;

                if (serviceCatJob.HasAttachments)
                {
                    var attachments = requestPresenter.GetRequestAttachments(userRequest.SerReqId);

                    attachBs.DataSource  = attachBlist;
                    igridAtch.DataSource = attachBs;
                    foreach (var item in attachments)
                    {
                        attachBs.Add(item);
                    }
                }
                person = myView.baseDataPresenter.getPersonel(userRequest.Owneruserid ?? 0);
                if (serviceCatJob.ServiceCategory.HasDevices)
                {
                    var device = baseDataPresenter.GetDevice(userRequest.Transferid ?? 0);

                    if (device != null)
                    {
                        PersonDevice pd = new PersonDevice(device, person);
                        igridDeviceList.DataSource = new List <PersonDevice>()
                        {
                            pd
                        };
                    }
                }
                if (userRequest.Owneruserid != userRequest.Createuserid)
                {
                    txtOwnername.Text = person.FullName;
                }
                btnCreateRequest.Visible  = false;
                txtContact.ReadOnly       = true;
                txtDescription.ReadOnly   = true;
                txtMenu.ReadOnly          = true;
                txtRequester.ReadOnly     = true;
                btnMInAtc.Enabled         = false;
                btnSelectAttch.Enabled    = false;
                btnSelectMenu.Enabled     = false;
                btnSelectOwner.Enabled    = false;
                btnViewWorks.Visible      = true;
                igridDeviceList.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False;
                LoadAttachment(row.SER_REQ_ID);
                igridAtch.AllowEdit = Janus.Windows.GridEX.InheritableBoolean.False;
            }
            SetGrid();
        }