Ejemplo n.º 1
0
        /// <summary>
        /// Handles the OnClick event of the lbtnCloseRequests control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void lbtnCloseRequests_OnClick(object sender, EventArgs e)
        {
            foreach (ListItem item in chxRequestsList.Items)
            {
                if (item.Selected)
                {
                    var request = DataManager.Request.SelectById(SiteId, Guid.Parse(item.Value));
                    request.RequestStatusID = (int)RequestStatus.Closed;
                    DataManager.Request.Update(request);
                }
            }

            Response.Redirect(UrlsData.AP_Requirements());
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Handles the OnClick event of the lbtnSave control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void lbtnSave_OnClick(object sender, EventArgs e)
        {
            if (!Page.IsValid)
            {
                return;
            }

            if (!access.Write)
            {
                return;
            }

            var requirement = DataManager.Requirement.SelectById(SiteId, _requirementId) ?? new tbl_Requirement();

            requirement.ShortDescription = (txtShortDescription.Text.Length > 2048
                                                ? txtShortDescription.Text.Substring(0, 2048)
                                                : txtShortDescription.Text);

            //requirement.LongDescription = ucLongDescription.Content;

            requirement.RequestSourceTypeID = dcbRequestSourceType.SelectedIdNullable;

            requirement.RequirementStatusID = ucRequirementStatus.RequirementStatusId;

            requirement.RequestID           = dcbRequests.SelectedIdNullable;
            requirement.ProductID           = dcbProducts.SelectedIdNullable;
            requirement.CompanyID           = dcbCompany.SelectedIdNullable;
            requirement.ContactID           = ucContact.SelectedValue;
            requirement.ProductSeriesNumber = txtProductSeriesNumber.Text;
            requirement.RequirementTypeID   = dcbRequirementType.SelectedId;

            requirement.RequirementSeverityOfExposureID = dcbRequirementSeverityOfExposure.SelectedIdNullable;

            requirement.ServiceLevelID = dcbServiceLevel.SelectedId;

            requirement.ParentID = ucParentRequirment.ParentRequirementId;

            requirement.RequirementPriorityID   = dcbRequirementPriority.SelectedIdNullable;
            requirement.RequirementComplexityID = dcbRequirementComplexity.SelectedIdNullable;

            if (ucPublicationCategory.SelectedCategoryId != Guid.Empty)
            {
                requirement.PublicationCategoryID = ucPublicationCategory.SelectedCategoryId;
            }
            else
            {
                requirement.PublicationCategoryID = null;
            }

            requirement.ResponsibleID          = ucResponsible.SelectedValue;
            requirement.RealizationDatePlanned = rdpRealizationDatePlanned.SelectedDate;
            requirement.RealizationDateActual  = rdpRealizationDateActual.SelectedDate;
            requirement.ContractID             = dcbContract.SelectedIdNullable;
            requirement.OrderID   = dcbOrder.SelectedIdNullable;
            requirement.InvoiceID = dcbInvoice.SelectedIdNullable;
            requirement.EvaluationRequirementsProductID = dcbEvaluationRequirementsProducts.SelectedIdNullable;
            requirement.AnyProductName = txtAnyProductName.Text;
            requirement.Quantity       = (decimal)rntxtQuantity.Value;
            requirement.CurrencyID     = dcbCurrency.SelectedIdNullable;
            requirement.CurrencyPrice  = (decimal)rntxtCurrencyPrice.Value;
            requirement.CurrencyAmount = (decimal)rntxtCurrencyAmount.Value;
            requirement.UnitID         = dcbUnit.SelectedIdNullable;
            requirement.Rate           = (decimal)rntxtRate.Value;
            requirement.Price          = (decimal)rntxtPrice.Value;
            requirement.Amount         = (decimal)rntxtAmount.Value;
            requirement.RequirementImplementationCompleteID = dcbRequirementImplementationComplete.SelectedIdNullable;
            requirement.RequirementSpeedTimeID    = dcbRequirementSpeedTime.SelectedIdNullable;
            requirement.RequirementSatisfactionID = dcbRequirementSatisfaction.SelectedIdNullable;
            requirement.EstimationComment         = txtEstimationComment.Text;

            requirement.InternalUnitID           = dcbInternalUnit.SelectedIdNullable;
            requirement.InternalQuantity         = (decimal)rntxtInternalQuantity.Value;
            requirement.EstimateCommentInternal  = txtEstimateCommentInternal.Text;
            requirement.EstimateCommentForClient = txtEstimateCommentForClient.Text;

            if (requirement.ID == Guid.Empty)
            {
                requirement.SiteID    = SiteId;
                requirement.OwnerID   = CurrentUser.Instance.ContactID;
                requirement.CreatedAt = DateTime.Now;

                var requestSourceType = DataManager.RequirementType.SelectById(SiteId, requirement.RequirementTypeID);
                if (requestSourceType != null)
                {
                    var documentNumerator = DocumentNumerator.GetNumber((Guid)requestSourceType.NumeratorID, requirement.CreatedAt, requestSourceType.tbl_Numerator.Mask, "tbl_Requirement");
                    requirement.Number       = documentNumerator.Number;
                    requirement.SerialNumber = documentNumerator.SerialNumber;
                }

                DataManager.Requirement.Add(requirement);

                if (!string.IsNullOrEmpty(ucComment.Content))
                {
                    var contactId = requirement.ContactID ?? CurrentUser.Instance.ContactID;

                    var user = DataManager.User.SelectByContactIdExtended(SiteId, (Guid)contactId) ??
                               DataManager.User.AddPortalUser(SiteId, (Guid)contactId);

                    if (user != null)
                    {
                        ContentCommentRepository.Add(CurrentUser.Instance.SiteID, user.ID, requirement.ID, ucComment.Content, null, null, string.Empty,
                                                     CommentTables.tbl_RequirementComment, false, false);
                    }
                }

                if (!string.IsNullOrEmpty(txtComment.Text))
                {
                    var fileName = string.Empty;
                    if (rauFileUpload.UploadedFiles.Count > 0)
                    {
                        var fsp = new FileSystemProvider();
                        fileName = fsp.Upload(CurrentUser.Instance.SiteID,
                                              EnumHelper.GetEnumDescription(CommentTables.tbl_RequirementComment),
                                              rauFileUpload.UploadedFiles[0].FileName, rauFileUpload.UploadedFiles[0].InputStream, FileType.Attachment);
                    }

                    ContentCommentRepository.Add(CurrentUser.Instance.SiteID, CurrentUser.Instance.ID, requirement.ID, txtComment.Text, null, null, fileName,
                                                 CommentTables.tbl_RequirementComment, chxIsOfficialAnswer.Checked, false);
                }
            }
            else
            {
                DataManager.Requirement.Update(requirement);
            }

            if (!CheckRequestsToClose(requirement))
            {
                Response.Redirect(UrlsData.AP_Requirements());
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Handles the Load event of the Page control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Page.RouteData.Values["id"] != null)
            {
                _requirementId = Guid.Parse(Page.RouteData.Values["id"] as string);
            }

            dprReminder.RegisterSkipCheckingTrigger(RadTabStrip1);
            dprReminder.RegisterSkipCheckingTrigger(ucContentComments.TextBoxEditor);
            dprReminder.RegisterSkipCheckingTrigger(ucContentComments.HtmlEditor);
            dprReminder.RegisterSkipCheckingTrigger(lbtnSave);

            if (_requirementId == Guid.Empty)
            {
                dprReminder.MarkPageClean();
            }

            Title = "Требование - LeadForce";

            if (!Page.IsPostBack && !DataManager.RequirementStatus.SelectAll(SiteId).Any())
            {
                radWindowManager.RadAlert("Перед тем как создавать требование, нужно заполнить справочники для запросов и требований", 420, 100, "Предупреждение", "RedirectToRequirements");
                return;
            }

            access = Access.Check();
            if (!access.Write)
            {
                lbtnSave.Visible = false;
            }

            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbServiceLevel, dcbServiceLevel, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbServiceLevel, rdpRealizationDatePlanned, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbRequirementType, dcbRequirementType, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbRequirementType, ucRequirementStatus, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbRequirementType, dcbRequirementSeverityOfExposure, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbRequests, dcbServiceLevel, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbCompany, ucParentRequirment, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(ucRequirementStatus, ucResponsible, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbCompany, ucRequirementStatus, null, UpdatePanelRenderMode.Inline);
            RadAjaxManager.GetCurrent(Page).AjaxSettings.AddAjaxSetting(dcbServiceLevel, ucRequirementStatus, null, UpdatePanelRenderMode.Inline);

            ucRequirementStatus.RequirementStatusChanged += ucRequirementStatus_RequirementStatusChanged;
            ajaxPanel.AjaxRequest += ajaxPanel_AjaxRequest;

            ucContentComments.ContentId = _requirementId;
            gridRequirementHistory.Where.Add(new GridWhere()
            {
                Column = "RequirementID", Value = _requirementId.ToString()
            });

            hlCancel.NavigateUrl = UrlsData.AP_Requirements();
            hlCancelCloseRequests.NavigateUrl = UrlsData.AP_Requirements();

            ucRequirementStatus.RequirementId = _requirementId;

            gridRequests.Actions.Add(new GridAction {
                Text = "Карточка запроса", NavigateUrl = string.Format("~/{0}/Requests/Edit/{{0}}", CurrentTab), ImageUrl = "~/App_Themes/Default/images/icoView.png"
            });
            gridRequests.SiteID = SiteId;

            if (!Page.IsPostBack)
            {
                BindData();
            }
        }