Ejemplo n.º 1
0
        protected void ctlDelete_Click(object sender, ImageClickEventArgs e)
        {
            foreach (GridViewRow row in ctlRejectReasonGridView.Rows)
            {
                if ((row.RowType == DataControlRowType.DataRow) && (((CheckBox)row.FindControl("ctlSelect")).Checked))
                {
                    try
                    {
                        short       id     = UIHelper.ParseShort(ctlRejectReasonGridView.DataKeys[row.RowIndex]["ReasonID"].ToString());
                        DbScgReason reason = DbReasonService.FindByIdentity(id);
                        DbReasonService.Delete(reason);
                    }
                    catch (Exception ex)
                    {
                        if (((System.Data.SqlClient.SqlException)(ex.GetBaseException())).Number == 547)
                        {
                            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertInUseData",
                                                                    "alert('This data is now in use.');", true);
                        }
                        ctlRejectReasonGridView.DataCountAndBind();
                    }
                }
            }

            ReasonLangGridViewFinish();
            ctlRejectReasonGridView.DataCountAndBind();
            ctlUpdatePanelGridView.Update();
            ctlRejectReasonGridView.DataBind();
        }
Ejemplo n.º 2
0
        protected void ctlSubmit_Click(object sender, ImageClickEventArgs e)
        {
            IList <DbScgReasonLang> list = new List <DbScgReasonLang>();
            short       reasonId         = UIHelper.ParseShort(ctlRejectReasonGridView.SelectedValue.ToString());
            DbScgReason reason           = new DbScgReason(reasonId);

            foreach (GridViewRow row in ctlReasonLangGrid.Rows)
            {
                TextBox  detail  = row.FindControl("ctlReasonDetail") as TextBox;
                TextBox  comment = row.FindControl("ctlCommentLang") as TextBox;
                CheckBox active  = row.FindControl("ctlActiveLang") as CheckBox;

                if (!string.IsNullOrEmpty(detail.Text))
                {
                    short      languageId = UIHelper.ParseShort(ctlReasonLangGrid.DataKeys[row.RowIndex].Values["LanguageID"].ToString());
                    DbLanguage lang       = new DbLanguage(languageId);

                    DbScgReasonLang reasonLang = new DbScgReasonLang();
                    reasonLang.Reason       = reason;
                    reasonLang.Language     = lang;
                    reasonLang.ReasonDetail = detail.Text;
                    reasonLang.Comment      = comment.Text;
                    reasonLang.Active       = active.Checked;

                    GetReasonLangInfo(reasonLang);
                    list.Add(reasonLang);
                }
            }
            DbReasonLangService.UpdateReasonLang(list);
            ctlMessage.Message = GetMessage("SaveSuccessFully");
            ctlRejectReasonGridView.DataCountAndBind();
            ctlUpdatePanelGridView.Update();
        }
Ejemplo n.º 3
0
        protected void ctlReasonFormView_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            short       reasonId = UIHelper.ParseShort(ctlReasonFormView.DataKey.Value.ToString());
            DbScgReason reason   = new DbScgReason(reasonId);

            GetReasonInfo(reason);
            try
            {
                DbReasonService.UpdateReason(reason);
                ctlRejectReasonGridView.DataCountAndBind();
                ClosePopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }
Ejemplo n.º 4
0
        protected void ctlReasonFormView_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            DbScgReason reason = new DbScgReason();

            GetReasonInfo(reason);
            try
            {
                DbReasonService.AddReason(reason);
                ctlRejectReasonGridView.DataCountAndBind();
                ctlReasonFormView.ChangeMode(FormViewMode.ReadOnly);
                ClosePopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }
Ejemplo n.º 5
0
        private void GetReasonInfo(DbScgReason reason)
        {
            DropDownList documentType = ctlReasonFormView.FindControl("ctlDocumentTypeList") as DropDownList;
            TextBox      reasonCode   = ctlReasonFormView.FindControl("ctlReasonCode") as TextBox;
            TextBox      comment      = ctlReasonFormView.FindControl("ctlComment") as TextBox;
            CheckBox     active       = ctlReasonFormView.FindControl("ctlActive") as CheckBox;

            reason.ReasonCode     = reasonCode.Text;
            reason.DocumentTypeID = UIHelper.ParseInt(documentType.SelectedValue);
            reason.Comment        = comment.Text;
            reason.Active         = active.Checked;

            reason.CreBy   = UserAccount.UserID;
            reason.CreDate = DateTime.Now.Date;
            reason.UpdBy   = UserAccount.UserID;
            reason.UpdDate = DateTime.Now.Date;
            reason.UpdPgm  = ProgramCode;
        }