Beispiel #1
0
        protected void grdTimezone_RowUpdating(object sender, GridViewUpdateEventArgs e)
        {
            try
            {
                TextBox txttimezonedescEdit = grdTimezone.Rows[e.RowIndex].FindControl("txttimezonedescEdit") as TextBox;
                HiddenField hdfTimezoneid = grdTimezone.Rows[e.RowIndex].FindControl("hdfTimezoneid") as HiddenField;
                CheckBox chkStatus = grdTimezone.Rows[e.RowIndex].FindControl("chkStatus") as CheckBox;

                if (txttimezonedescEdit.Text.Length == 0)
                {
                    lblerrmsg.Text = "Timezone name should not be empty";
                    return;
                }
                string status;
                if (chkStatus.Checked == true)
                {
                    status = "Y";
                }
                else
                {
                    status = "N";
                }
                int afctrows;
                objData = new MasterData();
                TextInfo textInfo = cultureInfo.TextInfo;
                afctrows = objData.Timezone_Update(textInfo.ToTitleCase(txttimezonedescEdit.Text.Trim()), Convert.ToInt32(hdfTimezoneid.Value.Trim()), status);
                if (afctrows == 102)
                {
                    lblerrmsg.Text = "Timezone already exists.";
                    return;
                }
                else if (afctrows == 103)
                {
                    lblerrmsg.Text = "Timezone can’t be deleted as is in use by an city";
                    return;
                }
                grdTimezone.EditIndex = -1;
                grdfill();
                divmsg.InnerHtml = "Record updated successfully!";
                (this.Master as Site1).ClearModifyStatus();
            }
            catch (Exception ex)
            {
                showerror(ex);
            }
        }