示例#1
0
 protected void ctlDelete_Click(object sender, ImageClickEventArgs e)
 {
     foreach (GridViewRow row in ctlZoneGridView.Rows)
     {
         if ((row.RowType == DataControlRowType.DataRow) && (((CheckBox)row.FindControl("ctlSelectChk")).Checked))
         {
             try
             {
                 short  zoneId = UIHelper.ParseShort(ctlZoneGridView.DataKeys[row.RowIndex].Value.ToString());
                 DbZone zone   = SsDbQueryProvider.DbZoneQuery.FindProxyByIdentity(zoneId);
                 DbZoneService.Delete(zone);
                 ZoneLangGridViewFinish();
             }
             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);
                 }
             }
         }
     }
     ctlZoneGridView.DataCountAndBind();
     ctlZoneUpdatePanel.Update();
 }
示例#2
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);
            }
        }