Example #1
0
        protected void ctlZoneGridView_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName.Equals("UserEdit"))
            {
                int   rowIndex = ((GridViewRow)((ImageButton)e.CommandSource).NamingContainer).RowIndex;
                short zoneId   = UIHelper.ParseShort(ctlZoneGridView.DataKeys[rowIndex].Value.ToString());
                ctlZoneForm.PageIndex = (ctlZoneGridView.PageIndex * ctlZoneGridView.PageSize) + rowIndex;
                ctlZoneForm.ChangeMode(FormViewMode.Edit);
                IList <DbZoneResult> zoneList = SsDbQueryProvider.DbZoneQuery.FindZoneByID(zoneId, UserAccount.CurrentLanguageID);

                ctlZoneForm.DataSource = zoneList;
                ctlZoneForm.DataBind();
                ctlZoneGridView.DataCountAndBind();
                ctlZoneFormUpdatePanel.Update();
                ctlZoneModalPopupExtender.Show();
                ZoneLangGridViewFinish();
            }
            if (e.CommandName.Equals("Select"))
            {
                int   rowIndex = ((GridViewRow)((LinkButton)e.CommandSource).NamingContainer).RowIndex;
                short zoneId   = UIHelper.ParseShort(ctlZoneGridView.DataKeys[rowIndex].Value.ToString());
                ctlZoneLangGrid.DataSource = DbZoneLangService.FindZoneLangByZoneID(zoneId);
                ctlZoneLangGrid.DataBind();
                ctlZoneLangButton.Visible = true;
                ctlZoneLangGrid.Visible   = true;
                ctlZoneLangFds.Visible    = true;
                ctlZoneGridView.DataCountAndBind();
                ctlZoneUpdatePanel.Update();
                ctlZoneLangUpdatePanel.Update();
            }
        }
Example #2
0
        protected void ctlSubmit_Click(object sender, ImageClickEventArgs e)
        {
            IList <DbZoneLang> zoneLangList = new List <DbZoneLang>();

            DbZone zone = new DbZone(UIHelper.ParseShort(ctlZoneGridView.SelectedValue.ToString()));

            foreach (GridViewRow row in ctlZoneLangGrid.Rows)
            {
                TextBox  ctlZoneName  = (TextBox)ctlZoneLangGrid.Rows[row.RowIndex].FindControl("ctlZoneName");
                TextBox  ctlComment   = (TextBox)ctlZoneLangGrid.Rows[row.RowIndex].FindControl("ctlComment");
                CheckBox ctlActiveChk = (CheckBox)ctlZoneLangGrid.Rows[row.RowIndex].FindControl("ctlActive");
                if (!string.IsNullOrEmpty(ctlZoneName.Text) || !string.IsNullOrEmpty(ctlComment.Text))
                {
                    DbZoneLang zoneLang = new DbZoneLang();
                    DbLanguage Lang     = new DbLanguage(UIHelper.ParseShort(ctlZoneLangGrid.DataKeys[row.RowIndex].Value.ToString()));
                    zoneLang.Language = Lang;
                    zoneLang.Zone     = zone;
                    zoneLang.ZoneName = ctlZoneName.Text;
                    zoneLang.Comment  = ctlComment.Text;
                    zoneLang.Active   = ctlActiveChk.Checked;
                    zoneLang.CreBy    = UserAccount.UserID;
                    zoneLang.CreDate  = DateTime.Now;
                    zoneLang.UpdBy    = UserAccount.UserID;
                    zoneLang.UpdDate  = DateTime.Now;
                    zoneLang.UpdPgm   = ProgramCode;
                    zoneLangList.Add(zoneLang);
                }
            }
            DbZoneLangService.UpdateZoneLang(zoneLangList);
            ctlMessage.Message = GetMessage("SaveSuccessFully");
        }
Example #3
0
        protected void ctlZoneForm_ItemInserting(object sender, FormViewInsertEventArgs e)
        {
            TextBox ctlZoneName = (TextBox)ctlZoneForm.FindControl("ctlZoneName");

            DbZoneLang zoneLang = new DbZoneLang();
            DbZone     zone     = new DbZone();

            GetZoneInfo(zone, "Insert");
            zoneLang.Zone     = zone;
            zoneLang.Language = DbLanguageService.FindByIdentity(UIHelper.ParseShort(UserAccount.CurrentLanguageID.ToString()));
            zoneLang.ZoneName = ctlZoneName.Text;
            zoneLang.CreBy    = UserAccount.UserID;
            zoneLang.CreDate  = DateTime.Now;
            zoneLang.UpdBy    = UserAccount.UserID;
            zoneLang.UpdDate  = DateTime.Now;
            zoneLang.UpdPgm   = ProgramCode;
            zoneLang.Active   = true;

            try
            {
                DbZoneLangService.AddZoneLang(zone, zoneLang);
                ctlZoneGridView.DataCountAndBind();
                ctlZoneForm.ChangeMode(FormViewMode.ReadOnly);
                CloseZonePopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }
Example #4
0
        protected void ctlZoneForm_ItemUpdating(object sender, FormViewUpdateEventArgs e)
        {
            short zoneId     = UIHelper.ParseShort(ctlZoneForm.DataKey["ZoneID"].ToString());
            short zoneLangId = UIHelper.ParseShort(ctlZoneForm.DataKey["ZoneLangID"].ToString());

            DbZone zone = DbZoneService.FindByIdentity(zoneId);

            GetZoneInfo(zone, "Update");
            try
            {
                DbZoneLangService.UpdateZoneLang(zone);
                ctlZoneGridView.DataCountAndBind();
                ctlZoneForm.ChangeMode(FormViewMode.ReadOnly);
                CloseZonePopUp();
            }
            catch (ServiceValidationException ex)
            {
                ValidationErrors.MergeErrors(ex.ValidationErrors);
            }
        }