protected void cmdSave_Click(object sender, EventArgs e)
        {
            try
            {
                lstError = new List<Errorobject>();
                CRestrictedPages DAL = new CRestrictedPages();

                if (!DAL.Wcmm_Deleteall())
                {
                    lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Remove_completed, "", null);
                    Master.Form_ShowError(lstError);
                    return;
                }

                string RestrictedPages = "#";
                if (ddlPathandQuery.Items.Count > 0)
                {
                    List<Settingsite.RestrictedPages> list = new List<Settingsite.RestrictedPages>();
                    foreach (ListItem item in ddlPathandQuery.Items)
                    {
                        Settingsite.RestrictedPages info = new Settingsite.RestrictedPages();
                        info.Id = 0;
                        info.PathandQuery = item.Text;
                        if (item.Text.IndexOf(".aspx?") != -1)
                        {
                            string[] PathandQuery = item.Text.Split('?');
                            info.Name = PathandQuery[0];
                            info.Query = PathandQuery[1];
                        }
                        else
                        {
                            info.Name = item.Text;
                            info.Query = "";
                        }
                        RestrictedPages += info.Name + "#";
                        list.Add(info);
                    }

                    if (!DAL.Save(list))
                    {
                        lstError = Form_GetError(lstError, Errortype.Error, Definephrase.Save_error, "", null);
                        Master.Form_ShowError(lstError);
                        return;
                    }
                }
                Application["RestrictedPages"] = RestrictedPages == "#" ? "" : RestrictedPages;

                CConstants.PAGE_WELCOMEDEF = Re_radPage.SelectedIndex == 0 ? "" : Re_txtPage.Text.Trim();
                CConstants.REGISTERCONFIRM = radRegisterconfirm.SelectedIndex;

                lstError = Form_GetError(lstError, Errortype.Completed, Definephrase.Save_completed, "", null);
                Master.Form_ShowError(lstError);

            }
            catch (Exception ex)
            {
                CCommon.CatchEx(ex);
            }
        }
Esempio n. 2
0
        private Settingsite.RestrictedPages getDataReader(iSqlDataReader dar)
        {
            try
            {
                int i = -1;
                Settingsite.RestrictedPages info = new Settingsite.RestrictedPages();
                info.Name = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Query = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.PathandQuery = dar.IsDBNull(++i) ? string.Empty : dar.GetString(i);
                info.Id = dar.IsDBNull(++i) ? 0 : dar.GetInt32(i);

                return info;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }