private void Bindlistddls()
        {
            try
            {
                ListManagementDataContext db = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                var LINQ = db.sp_GetListEntrybyNameAndID("Country", -1, GetCurrentCultureName);
                ddlDefaultLanguage.DataSource     = LINQ;
                ddlDefaultLanguage.DataTextField  = "Text";
                ddlDefaultLanguage.DataValueField = "Value";
                ddlDefaultLanguage.DataBind();
                //LINQ = db.sp_GetListEntrybyNameAndID("Processor", -1,GetCurrentCultureName);
                //ddlPaymentProcessor.DataSource = LINQ;
                //ddlPaymentProcessor.DataTextField = "Text";
                //ddlPaymentProcessor.DataValueField = "Value";
                //ddlPaymentProcessor.DataBind();

                ////ddlCurrency
                //LINQ = db.sp_GetListEntrybyNameAndID("Currency", -1,GetCurrentCultureName);
                //ddlCurrency.DataSource = LINQ;
                //ddlCurrency.DataTextField = "Text";
                //ddlCurrency.DataValueField = "Value";
                //ddlCurrency.DataBind();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 2
0
 private void DeleteList(int entryId)
 {
     try
     {
         ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
         var deleteList = dbList.sp_ListEntryDeleteByID(entryId, true, GetCurrentCultureName);
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 3
0
 protected void imgDeleteList_Click(object sender, EventArgs e)
 {
     try
     {
         if (ViewState["LISTNAME"] != null)
         {
             ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
             var listByName = dbList.sp_GetListEntriesByNameParentKeyAndPortalID(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString(), -1, GetCurrentCultureName);//GetPortalID;
             foreach (sp_GetListEntriesByNameParentKeyAndPortalIDResult listEntry in listByName)
             {
                 GetListByEntryId(listEntry.EntryID);
                 DeleteList(listEntry.EntryID);
                 BindTreeView();
                 pnlListAll.Visible = false;
                 BindGridOnPageLoad();
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsDeletedSuccessfully"), "", SageMessageType.Success);
             }
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 4
0
 protected void cddl_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         if (ViewState["SddlID"] != null)
         {
             DropDownList ddl = (DropDownList)sender;
             string listName = "Region";
             string parentKey = "Country." + ddl.SelectedItem.Value;
             ListManagementDataContext Sdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
             var listDetail = Sdb.sp_GetListEntriesByNameParentKeyAndPortalID(listName, parentKey, -1,GetCurrentCultureName);
             DropDownList Sddl = (DropDownList)this.FindControl(ViewState["SddlID"].ToString());
             if (Sddl != null)
             {
                 Sddl.DataSource = listDetail;
                 Sddl.DataValueField = "Value";
                 Sddl.DataTextField = "Text";
                 Sddl.DataBind();
             }
             ShowHideStaterow();
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 5
0
 protected void gdvSubList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
         int entryId = int.Parse(e.CommandArgument.ToString());
         if (e.CommandName == "Delete")
         {
             try
             {
                 var deleteList = dbList.sp_ListEntryDeleteByID(entryId, true, GetCurrentCultureName);
                 // ShowMessage(SageMessageTitle.Information.ToString(), "List is deleted successfully", "", SageMessageType.Success);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsDeletedSuccessfully"), "", SageMessageType.Success);
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         else if (e.CommandName == "SortUp")
         {
             try
             {
                 var sortList = dbList.sp_ListSortOrderUpdate(entryId, true, GetCurrentCultureName);
                 //  ShowMessage(SageMessageTitle.Information.ToString(), "The List is shifted up successfully", "", SageMessageType.Success);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "TheListIsShiftedUpSuccessfully"), "", SageMessageType.Success);
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         else if (e.CommandName == "SortDown")
         {
             try
             {
                 var sortList = dbList.sp_ListSortOrderUpdate(entryId, false, GetCurrentCultureName);
                 // ShowMessage(SageMessageTitle.Information.ToString(), "The List is shifted downn successfully", "", SageMessageType.Success);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "TheListIsShiftedDownSuccessfully"), "", SageMessageType.Success);
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         else if (e.CommandName == "Edit")
         {
             try
             {
                 HideControls();
                 ViewState["ENTRYID"] = entryId;
                 var editList = dbList.sp_GetListEntrybyNameValueAndEntryID("", "", entryId, GetCurrentCultureName);
                 foreach (sp_GetListEntrybyNameValueAndEntryIDResult getListEntry in editList)
                 {
                     txtEntryText.Text     = getListEntry.Text;
                     txtEntryValue.Text    = getListEntry.Value;
                     txtCurrencyCode.Text  = getListEntry.CurrencyCode;
                     txtDisplayLocale.Text = getListEntry.DisplayLocale;
                     chkActive.Checked     = (bool)getListEntry.IsActive;
                     AddEditMode();
                     //  ShowMessage(SageMessageTitle.Information.ToString(), "List is edited successfully", "", SageMessageType.Success);
                     //ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsEditedSuccessfully"), "", SageMessageType.Success);
                 }
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         if (ViewState["LISTNAME"] != null)
         {
             BindGrid(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString());
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 6
0
        private void AddNewList()
        {
            string listName                  = txtListName.Text.Trim();
            string value                     = txtEntryValue.Text.Trim();
            string text                      = txtEntryText.Text.Trim();
            int    parentId                  = 0;
            int    level                     = 0;
            int    definitionId              = -1;
            int    portalId                  = -1;// GetPortalID;
            string createdBy                 = GetUsername;
            bool   displayOrder              = false;
            bool   isActive                  = false;
            string currencyCode              = txtCurrencyCode.Text.Trim();
            string displayLocale             = txtDisplayLocale.Text.Trim();
            ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);

            if (chkShort.Checked == true)
            {
                displayOrder = true;
            }

            if (chkActive.Checked == true)
            {
                isActive = true;
            }
            if (ddlParentList.SelectedIndex != 0)
            {
                try
                {
                    parentId = int.Parse(ddlParentEntry.SelectedValue.ToString());
                    string   selectedListName  = string.Empty;
                    string[] selectedListNames = SplitString(ddlParentEntry.SelectedItem.Text);
                    selectedListName = selectedListNames[0];

                    var listLevel = dbList.sp_GetListEntrybyNameValueAndEntryID(selectedListName, "", int.Parse(ddlParentEntry.SelectedValue.ToString()), GetCurrentCultureName);
                    foreach (sp_GetListEntrybyNameValueAndEntryIDResult parentLevel in listLevel)
                    {
                        level = int.Parse(parentLevel.LEVEL.ToString()) + 1;
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
            try
            {
                int ListID = ListManagementController.AddNewList(new ListInfo(listName, value, text, parentId, level, currencyCode, displayLocale, displayOrder, definitionId, "", portalId, isActive, createdBy, GetCurrentCultureName));

                if (ListID == 0)
                {
                    ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("ListSettings", "ListAlreadyExists"), "", SageMessageType.Alert);
                }
                else
                {
                    BindTreeView();
                    ViewMode();
                    ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsAddedSuccessfully"), "", SageMessageType.Success);
                    BindGridOnPageLoad();
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
        private void Bindlistddls()
        {
            try
            {
                ListManagementDataContext db = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                var LINQ = db.sp_GetListEntrybyNameAndID("Country", -1,GetCurrentCultureName);
                ddlDefaultLanguage.DataSource = LINQ;
                ddlDefaultLanguage.DataTextField = "Text";
                ddlDefaultLanguage.DataValueField = "Value";
                ddlDefaultLanguage.DataBind();
                //LINQ = db.sp_GetListEntrybyNameAndID("Processor", -1,GetCurrentCultureName);
                //ddlPaymentProcessor.DataSource = LINQ;
                //ddlPaymentProcessor.DataTextField = "Text";
                //ddlPaymentProcessor.DataValueField = "Value";
                //ddlPaymentProcessor.DataBind();

                ////ddlCurrency
                //LINQ = db.sp_GetListEntrybyNameAndID("Currency", -1,GetCurrentCultureName);
                //ddlCurrency.DataSource = LINQ;
                //ddlCurrency.DataTextField = "Text";
                //ddlCurrency.DataValueField = "Value";
                //ddlCurrency.DataBind();
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 8
0
        private void AddNewList()
        {
            string listName = txtListName.Text.Trim();
            string value = txtEntryValue.Text.Trim();
            string text = txtEntryText.Text.Trim();
            int parentId = 0;
            int level = 0;
            int definitionId = -1;
            int portalId = -1;// GetPortalID;
            string createdBy = GetUsername;
            bool displayOrder = false;
            bool isActive = false;
            string currencyCode = txtCurrencyCode.Text.Trim();
            string displayLocale = txtDisplayLocale.Text.Trim();
            ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
            if (chkShort.Checked == true)
            {
                displayOrder = true;
            }

            if (chkActive.Checked == true)
            {
                isActive = true;
            }
            if (ddlParentList.SelectedIndex != 0)
            {
                try
                {
                    parentId = int.Parse(ddlParentEntry.SelectedValue.ToString());
                    string selectedListName = string.Empty;
                    string[] selectedListNames = SplitString(ddlParentEntry.SelectedItem.Text);
                    selectedListName = selectedListNames[0];

                    var listLevel = dbList.sp_GetListEntrybyNameValueAndEntryID(selectedListName, "", int.Parse(ddlParentEntry.SelectedValue.ToString()),GetCurrentCultureName);
                    foreach (sp_GetListEntrybyNameValueAndEntryIDResult parentLevel in listLevel)
                    {
                        level = int.Parse(parentLevel.LEVEL.ToString()) + 1;
                    }
                }
                catch (Exception ex)
                {
                    ProcessException(ex);
                }
            }
            try
            {
                int ListID = ListManagementController.AddNewList(new ListInfo(listName, value, text, parentId, level, currencyCode, displayLocale, displayOrder, definitionId, "", portalId, isActive, createdBy, GetCurrentCultureName));

                if (ListID==0)
                {
                    ShowMessage(SageMessageTitle.Notification.ToString(), GetSageMessage("ListSettings", "ListAlreadyExists"), "", SageMessageType.Alert);

                }
                else
                {
                    BindTreeView();
                    ViewMode();
                    ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsAddedSuccessfully"), "", SageMessageType.Success);
                    BindGridOnPageLoad();
                }


            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 9
0
        protected void cddl_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                DropDownList ddl = (DropDownList)sender;
                string listName = "Region";
                string parentKey = "Country." + ddl.SelectedItem.Value;
                ListManagementDataContext Sdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                var listDetail = Sdb.sp_GetListEntriesByNameParentKeyAndPortalID(listName, parentKey, -1, GetCurrentCultureName);
                if (ddl.ID.StartsWith("P"))
                {

                    if (ViewState["VCddlPermanentState"] != null)
                    {

                        string strID = ViewState["VCddlPermanentState"].ToString();

                        DropDownList sddl = (DropDownList)this.FindControl(strID);
                        if (sddl != null)
                        {
                            sddl.DataSource = listDetail;
                            sddl.DataTextField = "Text";
                            sddl.DataValueField = "Value";
                            sddl.DataBind();
                            if (sddl.Items.Count > 0)
                            {
                                sddl.Parent.Parent.Visible = true;
                            }
                            else
                            {
                                sddl.Parent.Parent.Visible = false;
                            }
                        }
                    }
                }
                else
                {
                    if (ViewState["VCddlTemporaryState"] != null)
                    {
                        string strID = ViewState["VCddlPermanentState"].ToString();
                        DropDownList sddl = (DropDownList)this.FindControl(strID);
                        if (sddl != null)
                        {
                            sddl.DataSource = listDetail;
                            sddl.DataTextField = "Text";
                            sddl.DataValueField = "Value";
                            sddl.DataBind();
                            if (sddl.Items.Count > 0)
                            {
                                sddl.Parent.Parent.Visible = true;
                            }
                            else
                            {
                                sddl.Parent.Parent.Visible = false;
                            }
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 10
0
        private void FormGenerator()
        {

            if (pnlFormView.Controls.Count == 1)
            {
                var LINQFormGenerator = db.sp_FeedbackItemGet(GetPortalID, GetCurrentCultureName);
                CommonFunction CF = new CommonFunction();
                DataTable dt = CF.LINQToDataTable(LINQFormGenerator);
                if (dt != null && dt.Rows.Count > 0)
                {


                    string ParentKey = string.Empty;
                    string parentKey = string.Empty;
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        System.Web.UI.HtmlControls.HtmlGenericControl hmpr = new System.Web.UI.HtmlControls.HtmlGenericControl("div");
                        hmpr.Attributes.Add("class", "cssClassContactFormField");
                        bool IsActive = bool.Parse(dt.Rows[i]["IsActive"].ToString());

                        string FeedbackItem = dt.Rows[i]["FeedbackItem"].ToString();
                        int FeedbackItemID = Int32.Parse(dt.Rows[i]["FeedbackItemID"].ToString());


                        if (IsActive)
                        {
                            if ((dt.Rows[i]["FeedbackItem"].ToString() == "FormTitle"))
                            {
                                ContactInformation.InnerHtml += "<h1>" + dt.Rows[i]["FieldCaption"].ToString() + "</h1>";
                                ContactInformation.Visible = true;
                            }
                            else if (dt.Rows[i]["FeedbackItem"].ToString() == "FormInfo")
                            {
                                string strTemp = dt.Rows[i]["FieldCaption"].ToString();
                                strTemp = strTemp.Replace("\r", "<br />");
                                ContactInformation.InnerHtml += strTemp;
                                ContactInformation.Visible = true;
                            }
                            else if ((dt.Rows[i]["FeedbackItem"].ToString() == "FormTitle" || dt.Rows[i]["FeedbackItem"].ToString() == "FormInfo") && IsActive == false)
                            {
                                ContactInformation.Visible = false;
                            }
                            else
                            {
                                Label lblFormLabel = new Label();
                                lblFormLabel.ID = "lblFormLabel_" + FeedbackItemID;
                                lblFormLabel.Text = dt.Rows[i]["FieldCaption"].ToString();
                                lblFormLabel.ToolTip = dt.Rows[i]["FieldCaption"].ToString();
                                lblFormLabel.CssClass = "cssClassFormLabel";
                                lblFormLabel.EnableViewState = true;
                                System.Web.UI.HtmlControls.HtmlGenericControl plabel = new System.Web.UI.HtmlControls.HtmlGenericControl("p");
                                plabel.Controls.Add(lblFormLabel);
                                hmpr.Controls.Add(plabel);
                            }


                        }
                        System.Web.UI.HtmlControls.HtmlGenericControl pInput = new System.Web.UI.HtmlControls.HtmlGenericControl("p");
                        pInput.Attributes.Add("class", "cssClassContactFormInput");
                        int FeedbackItemID1 = Int32.Parse(dt.Rows[i]["FeedbackItemID"].ToString());
                        if (dt.Rows[i]["FeedbackItem"].ToString() == "Attachment")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    FileUpload FluForm = new FileUpload();
                                    FluForm.ID = FeedbackItem;
                                    FluForm.CssClass = "cssClassNormalFileUpload";
                                    FluForm.EnableViewState = true;
                                    pInput.Controls.Add(FluForm);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);

                                }
                            }

                        }

                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "Message")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    pInput.Attributes.Add("class", "cssClassContactFromTextArea");
                                    TextBox FormMessage = new TextBox();
                                    FormMessage.ID = FeedbackItem;
                                    FormMessage.CssClass = "";
                                    FormMessage.EnableViewState = true;
                                    FormMessage.TextMode = TextBoxMode.MultiLine;
                                    FormMessage.Rows = 5;
                                    FormMessage.Width = Unit.Parse("95%");
                                    RequiredFieldValidator rfvmessage = new RequiredFieldValidator();
                                    rfvmessage.ID = i.ToString();
                                    rfvmessage.ControlToValidate = FormMessage.ID;
                                    rfvmessage.CssClass = "cssClasssNormalRed";
                                    rfvmessage.ValidationGroup = "Feedback";
                                    rfvmessage.ErrorMessage = "*";
                                    rfvmessage.Display = ValidatorDisplay.Dynamic;
                                    rfvmessage.EnableViewState = true;
                                    pInput.Controls.Add(FormMessage);
                                    pInput.Controls.Add(rfvmessage);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }

                            }


                        }

                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "PermanentCountry" || dt.Rows[i]["FeedbackItem"].ToString() == "TemporaryCountry")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    DropDownList ddlPermanentandTemporaryCountry = new DropDownList();
                                    ddlPermanentandTemporaryCountry.ID = FeedbackItem;
                                    ddlPermanentandTemporaryCountry.CssClass = "cssClassDropDown";
                                    ddlPermanentandTemporaryCountry.EnableViewState = true;
                                    ddlPermanentandTemporaryCountry.SelectedIndexChanged += new EventHandler(cddl_SelectedIndexChanged);
                                    ListManagementDataContext dbpermanentcountry = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                                    var linqPermanentCountry = dbpermanentcountry.sp_GetListEntrybyNameAndID("Country", -1, GetCurrentCultureName);
                                    ddlPermanentandTemporaryCountry.DataSource = linqPermanentCountry;
                                    ddlPermanentandTemporaryCountry.DataValueField = "Value";
                                    ddlPermanentandTemporaryCountry.DataTextField = "Text";
                                    ddlPermanentandTemporaryCountry.DataBind();
                                    if (ddlPermanentandTemporaryCountry.Items.Count > 0)
                                    {
                                        ddlPermanentandTemporaryCountry.SelectedIndex = 0;
                                        ParentKey = "Country." + ddlPermanentandTemporaryCountry.SelectedItem.Value;
                                        ddlPermanentandTemporaryCountry.AutoPostBack = true;
                                    }
                                    pInput.Controls.Add(ddlPermanentandTemporaryCountry);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }

                        }
                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "PermanentState")
                        {
                            if (IsActive)
                            {
                                try
                                {

                                    DropDownList ddlPermanentState = new DropDownList();
                                    ddlPermanentState.ID = FeedbackItem;
                                    ddlPermanentState.CssClass = "cssClassDropDown";
                                    ddlPermanentState.EnableViewState = true;
                                    ddlPermanentState.AutoPostBack = true;
                                    ListManagementDataContext dbParmanentState = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                                    string listName = "Region";
                                    var linqPermanentState = dbParmanentState.sp_GetListEntriesByNameParentKeyAndPortalID(listName, ParentKey, -1, GetCurrentCultureName);
                                    ddlPermanentState.DataSource = linqPermanentState;
                                    ddlPermanentState.DataValueField = "Value";
                                    ddlPermanentState.DataTextField = "Text";
                                    ddlPermanentState.DataBind();
                                    if (ddlPermanentState.Items.Count > 0)
                                    {
                                        ddlPermanentState.SelectedIndex = 0;
                                    }
                                    else
                                    {
                                        hmpr.Visible = false;
                                    }
                                    pInput.Controls.Add(ddlPermanentState);
                                    hmpr.Controls.Add(pInput);
                                    ViewState["VCddlPermanentState"] = ddlPermanentState.ID;
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }



                        }
                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "TemporaryState")
                        {
                            if (IsActive)
                            {
                                try
                                {

                                    DropDownList ddlTemporaryState = new DropDownList();
                                    ddlTemporaryState.ID = FeedbackItem;
                                    ddlTemporaryState.CssClass = "cssClassDropDown";
                                    ddlTemporaryState.EnableViewState = true;
                                    ddlTemporaryState.AutoPostBack = true;
                                    ListManagementDataContext dbParmanentState = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                                    string listName = "Region";
                                    var linqPermanentState = dbParmanentState.sp_GetListEntriesByNameParentKeyAndPortalID(listName, ParentKey, -1, GetCurrentCultureName);
                                    ddlTemporaryState.DataSource = linqPermanentState;
                                    ddlTemporaryState.DataValueField = "Value";
                                    ddlTemporaryState.DataTextField = "Text";
                                    ddlTemporaryState.DataBind();
                                    if (ddlTemporaryState.Items.Count > 0)
                                    {
                                        ddlTemporaryState.SelectedIndex = 0;
                                    }
                                    else
                                    {
                                        hmpr.Visible = false;
                                    }
                                    pInput.Controls.Add(ddlTemporaryState);
                                    hmpr.Controls.Add(pInput);
                                    ViewState["VCddlTemporaryState"] = ddlTemporaryState.ID;
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }

                        }
                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "Email1" || dt.Rows[i]["FeedbackItem"].ToString() == "Email2")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    TextBox txtemail = new TextBox();
                                    txtemail.ID = FeedbackItem;
                                    txtemail.CssClass = "";
                                    txtemail.EnableViewState = true;

                                    RequiredFieldValidator rfvEmail = new RequiredFieldValidator();
                                    rfvEmail.ID = "rfvEmail_" + i.ToString();
                                    rfvEmail.ControlToValidate = txtemail.ID;
                                    rfvEmail.CssClass = "cssClasssNormalRed";
                                    rfvEmail.ValidationGroup = "Feedback";
                                    rfvEmail.ErrorMessage = "*";
                                    rfvEmail.EnableViewState = true;
                                    rfvEmail.Display = ValidatorDisplay.Dynamic;

                                    RegularExpressionValidator revemail = new RegularExpressionValidator();
                                    revemail.ID = "revEmail_" + i.ToString();
                                    revemail.ControlToValidate = txtemail.ID;
                                    revemail.CssClass = "cssClasssNormalRed";
                                    revemail.ValidationGroup = "Feedback";
                                    revemail.ValidationExpression = @"\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*";
                                    revemail.ErrorMessage = "*";
                                    revemail.EnableViewState = true;
                                    revemail.Display = ValidatorDisplay.Dynamic;
                                    pInput.Controls.Add(txtemail);
                                    pInput.Controls.Add(rfvEmail);
                                    pInput.Controls.Add(revemail);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }
                        }

                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "Mobile")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    TextBox txtmobile = new TextBox();
                                    txtmobile.ID = FeedbackItem;
                                    txtmobile.CssClass = "";
                                    txtmobile.EnableViewState = true;
                                    RegularExpressionValidator revmobile = new RegularExpressionValidator();
                                    revmobile.ID = i.ToString();
                                    revmobile.ControlToValidate = txtmobile.ID;
                                    revmobile.CssClass = "cssClasssNormalRed";
                                    revmobile.ValidationGroup = "Feedback";
                                    revmobile.ValidationExpression = @"^\d{10,20}";
                                    revmobile.ErrorMessage = "*";
                                    revmobile.EnableViewState = true;
                                    revmobile.Display = ValidatorDisplay.Dynamic;
                                    pInput.Controls.Add(txtmobile);
                                    pInput.Controls.Add(revmobile);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }

                        }
                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "Phone1" || dt.Rows[i]["FeedbackItem"].ToString() == "Phone2")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    TextBox txtphone = new TextBox();
                                    txtphone.ID = FeedbackItem;
                                    txtphone.CssClass = "";
                                    txtphone.EnableViewState = true;
                                    RegularExpressionValidator revphone = new RegularExpressionValidator();
                                    revphone.ID = i.ToString();
                                    revphone.ControlToValidate = txtphone.ID;
                                    revphone.CssClass = "cssClasssNormalRed";
                                    revphone.ValidationGroup = "Feedback";
                                    revphone.ValidationExpression = @"^\d{7,12}";
                                    revphone.ErrorMessage = "*";
                                    revphone.EnableViewState = true;
                                    revphone.Display = ValidatorDisplay.Dynamic;
                                    pInput.Controls.Add(txtphone);
                                    pInput.Controls.Add(revphone);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }
                        }
                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "Website")
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    TextBox txtwebsite = new TextBox();
                                    txtwebsite.ID = FeedbackItem;
                                    txtwebsite.CssClass = "";
                                    RegularExpressionValidator revwebsite = new RegularExpressionValidator();
                                    revwebsite.ID = i.ToString();
                                    revwebsite.ControlToValidate = txtwebsite.ID;
                                    revwebsite.CssClass = "cssClassNormalRed";
                                    revwebsite.ValidationGroup = "Feedback";
                                    revwebsite.ValidationExpression = @"^http\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$";
                                    revwebsite.ErrorMessage = "*";
                                    revwebsite.EnableViewState = true;
                                    revwebsite.Display = ValidatorDisplay.Dynamic;
                                    pInput.Controls.Add(txtwebsite);
                                    pInput.Controls.Add(revwebsite);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }

                            }
                        }
                        else if (dt.Rows[i]["FeedbackItem"].ToString() == "Name")
                        {

                            if (IsActive)
                            {
                                try
                                {
                                    TextBox FormTextBox = new TextBox();
                                    FormTextBox.ID = FeedbackItem;
                                    FormTextBox.CssClass = "";
                                    FormTextBox.EnableViewState = true;
                                    RequiredFieldValidator rfvName = new RequiredFieldValidator();
                                    rfvName.ID = i.ToString();
                                    rfvName.ControlToValidate = FormTextBox.ID;
                                    rfvName.CssClass = "cssClasssNormalRed";
                                    rfvName.ValidationGroup = "Feedback";
                                    rfvName.ErrorMessage = "*";
                                    rfvName.EnableViewState = true;
                                    rfvName.Display = ValidatorDisplay.Dynamic;
                                    pInput.Controls.Add(FormTextBox);
                                    pInput.Controls.Add(rfvName);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }

                        }
                        else if ((dt.Rows[i]["FeedbackItem"].ToString() != "FormTitle" && dt.Rows[i]["FeedbackItem"].ToString() != "FormInfo"))
                        {
                            if (IsActive)
                            {
                                try
                                {
                                    TextBox FormTextBox = new TextBox();
                                    FormTextBox.ID = FeedbackItem;
                                    FormTextBox.CssClass = "";
                                    FormTextBox.EnableViewState = true;
                                    RequiredFieldValidator rfv = new RequiredFieldValidator();
                                    rfv.ID = i.ToString();
                                    rfv.ControlToValidate = FormTextBox.ID;
                                    rfv.CssClass = "cssClasssNormalRed";
                                    rfv.ValidationGroup = "Feedback";
                                    rfv.ErrorMessage = "*";
                                    rfv.EnableViewState = true;
                                    rfv.Display = ValidatorDisplay.Dynamic;
                                    pInput.Controls.Add(FormTextBox);
                                    pInput.Controls.Add(rfv);
                                    hmpr.Controls.Add(pInput);
                                }
                                catch (Exception ex)
                                {
                                    ProcessException(ex);
                                }
                            }
                        }
                        if (hmpr.HasControls())
                        {
                            pnlFormView.Controls.Add(hmpr);
                        }
                    }
                }
            }
        }
Esempio n. 11
0
 protected void gdvSubList_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     try
     {
         ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
         int entryId = int.Parse(e.CommandArgument.ToString());
         if (e.CommandName == "Delete")
         {
             try
             {
                 var deleteList = dbList.sp_ListEntryDeleteByID(entryId, true,GetCurrentCultureName);
                // ShowMessage(SageMessageTitle.Information.ToString(), "List is deleted successfully", "", SageMessageType.Success);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsDeletedSuccessfully"), "", SageMessageType.Success);
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         else if (e.CommandName == "SortUp")
         {
             try
             {
                 var sortList = dbList.sp_ListSortOrderUpdate(entryId, true,GetCurrentCultureName);
               //  ShowMessage(SageMessageTitle.Information.ToString(), "The List is shifted up successfully", "", SageMessageType.Success);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "TheListIsShiftedUpSuccessfully"), "", SageMessageType.Success);
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         else if (e.CommandName == "SortDown")
         {
             try
             {
                 var sortList = dbList.sp_ListSortOrderUpdate(entryId, false,GetCurrentCultureName);
                // ShowMessage(SageMessageTitle.Information.ToString(), "The List is shifted downn successfully", "", SageMessageType.Success);
                 ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "TheListIsShiftedDownSuccessfully"), "", SageMessageType.Success);
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         else if (e.CommandName == "Edit")
         {
             try
             {
                 HideControls();
                 ViewState["ENTRYID"] = entryId;
                 var editList = dbList.sp_GetListEntrybyNameValueAndEntryID("", "", entryId,GetCurrentCultureName);
                 foreach (sp_GetListEntrybyNameValueAndEntryIDResult getListEntry in editList)
                 {
                     txtEntryText.Text = getListEntry.Text;
                     txtEntryValue.Text = getListEntry.Value;
                     txtCurrencyCode.Text = getListEntry.CurrencyCode;
                     txtDisplayLocale.Text = getListEntry.DisplayLocale;
                     chkActive.Checked = (bool)getListEntry.IsActive;
                     AddEditMode();
                   //  ShowMessage(SageMessageTitle.Information.ToString(), "List is edited successfully", "", SageMessageType.Success);
                     //ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsEditedSuccessfully"), "", SageMessageType.Success);
                 }
             }
             catch (Exception ex)
             {
                 ProcessException(ex);
             }
         }
         if (ViewState["LISTNAME"] != null)
         {
             BindGrid(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString());
         }
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 12
0
 private void DeleteList(int entryId)
 {
     try
     {
         ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
         var deleteList = dbList.sp_ListEntryDeleteByID(entryId, true,GetCurrentCultureName);
     }
     catch (Exception ex)
     {
         ProcessException(ex);
     }
 }
Esempio n. 13
0
        protected void imgDeleteList_Click(object sender, EventArgs e)
        {
            try
            {
                if (ViewState["LISTNAME"] != null)
                {
                    ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                    var listByName = dbList.sp_GetListEntriesByNameParentKeyAndPortalID(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString(), -1,GetCurrentCultureName);//GetPortalID;
                    foreach (sp_GetListEntriesByNameParentKeyAndPortalIDResult listEntry in listByName)
                    {
                        GetListByEntryId(listEntry.EntryID);
                        DeleteList(listEntry.EntryID);
                        BindTreeView();
                        pnlListAll.Visible = false;
                        BindGridOnPageLoad();
                        ShowMessage(SageMessageTitle.Information.ToString(), GetSageMessage("ListSettings", "ListIsDeletedSuccessfully"), "", SageMessageType.Success);
                        

                    }
                }
                
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 14
0
        private void FillFormData()
        {            
            try
            {

                //Geting Profile Exists Data
                #region "Loop For All Controls in Form To Fill Data"

                if (EditUserName == string.Empty)
                    EditUserName = GetUsername;

                
                Hashtable htProfile = new Hashtable();
                var LinqUserProfile = db.sp_UserProfileActiveListByUsername(EditUserName, GetPortalID);// UserProfileActiveListByUserID(mUserID, GetPortalID);

                if (LinqUserProfile != null)
                {
                    foreach (sp_UserProfileActiveListByUsernameResult objResult in LinqUserProfile)
                    {
                        htProfile.Add(objResult.ProfileID.ToString(), objResult.Value);
                    }
                }

                if (htProfile.Count > 0)
                {
                    #region "Loop Section"

                    foreach (Control cont in pnlForm.Controls)
                    {
                        if (cont.GetType() == typeof(Table))
                        {
                            foreach (Control pnlCon1 in cont.Controls)
                            {
                                if (pnlCon1.GetType() == typeof(TableRow))
                                {
                                    foreach (Control pnlCon2 in pnlCon1.Controls)
                                    {
                                        if (pnlCon2.GetType() == typeof(TableCell))
                                        {
                                            foreach (Control pnlCon3 in pnlCon2.Controls)
                                            {
                                                #region "Data Sections"
                                                //TextBox
                                                if (pnlCon3.GetType() == typeof(TextBox))
                                                {
                                                    TextBox txt = (TextBox)pnlCon3;
                                                    if (txt != null)
                                                    {
                                                        string conID = txt.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (htProfile.ContainsKey(Key))
                                                            {
                                                                txt.Text = htProfile[Key].ToString();
                                                            }
                                                        }
                                                    }
                                                }
                                                //DropDownList
                                                if (pnlCon3.GetType() == typeof(DropDownList))
                                                {
                                                    DropDownList ddl = (DropDownList)pnlCon3;
                                                    if (ddl != null)
                                                    {
                                                        string strStateddlID = string.Empty;
                                                        if (ViewState["SddlID"] != null)
                                                        {
                                                            strStateddlID = ViewState["SddlID"].ToString();
                                                        }
                                                        string conID = ddl.ID;
                                                        if (strStateddlID == conID)
                                                        {
                                                            if (ViewState["cddlID"] != null)
                                                            {
                                                                DropDownList ccddl = (DropDownList)this.FindControl(ViewState["cddlID"].ToString());
                                                                if (ccddl != null)
                                                                {
                                                                    if (ccddl.Items.Count > 0)
                                                                    {
                                                                        string parentKey = "Country." + ccddl.SelectedItem.Value;
                                                                        string listName = "Region";
                                                                        ListManagementDataContext Sdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                                                                        var listDetail = Sdb.sp_GetListEntriesByNameParentKeyAndPortalID(listName, parentKey, -1,GetCurrentCultureName);
                                                                        ddl.DataSource = listDetail;
                                                                        ddl.DataValueField = "Value";
                                                                        ddl.DataTextField = "Text";
                                                                        ddl.DataBind();
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (htProfile.ContainsKey(Key))
                                                            {
                                                                ddl.SelectedIndex = ddl.Items.IndexOf(ddl.Items.FindByText(htProfile[Key].ToString()));
                                                            }
                                                        }

                                                    }
                                                }
                                                //CheckBoxList
                                                if (pnlCon3.GetType() == typeof(CheckBoxList))
                                                {
                                                    CheckBoxList chbl = (CheckBoxList)pnlCon3;
                                                    if (chbl != null)
                                                    {
                                                        string conID = chbl.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (htProfile.ContainsKey(Key))
                                                            {
                                                                int Index = chbl.Items.IndexOf(chbl.Items.FindByText(htProfile[Key].ToString()));
                                                                chbl.Items[Index].Selected = true;
                                                            }
                                                        }
                                                    }
                                                }
                                                //RadioButtonList
                                                if (pnlCon3.GetType() == typeof(RadioButtonList))
                                                {
                                                    RadioButtonList rdbl = (RadioButtonList)pnlCon3;
                                                    if (rdbl != null)
                                                    {
                                                        string conID = rdbl.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (htProfile.ContainsKey(Key))
                                                            {
                                                                int Index = rdbl.Items.IndexOf(rdbl.Items.FindByText(htProfile[Key].ToString()));
                                                                rdbl.Items[Index].Selected = true;
                                                            }
                                                        }
                                                    }
                                                }

                                                //FileUpload
                                                if (pnlCon3.GetType() == typeof(FileUpload))
                                                {
                                                    FileUpload asFlu = (FileUpload)pnlCon3;
                                                    if (asFlu != null)
                                                    {
                                                        string conID = asFlu.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (htProfile.ContainsKey(Key))
                                                            {
                                                                //System.Web.UI.HtmlControls.HtmlGenericControl gcDiv = new HtmlGenericControl("div");
                                                                //gcDiv.ID = "BDDiv_" + ProfileID;
                                                                HtmlGenericControl sageDiv = (HtmlGenericControl)pnlCon2.FindControl("BDDiv_" + Key);
                                                                Image BDimg = (Image)sageDiv.FindControl("Bdimg_" + Key);
                                                                if (sageDiv != null && BDimg != null)
                                                                {
                                                                    string ImageName = htProfile[Key].ToString();
                                                                    string MapPath = "~/Modules/Admin/UserManagement/ProfileImage/MediumProfileImage/";
                                                                    string CurrentPath = MapPath + ImageName;
                                                                    BDimg.ImageUrl = CurrentPath;//GetTemplateImageUrl("imgedit.png", true); //this.Page.ResolveUrl(CurrentPath); ;
                                                                    sageDiv.Visible = true;
                                                                    //BDimg.Visible = true;
                                                                    //BDimg.Width = 200;
                                                                    //BDimg.Height = 200;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                HtmlGenericControl sageDiv = (HtmlGenericControl)pnlCon2.FindControl("BDDiv_" + Key);
                                                                Image BDimg = (Image)sageDiv.FindControl("Bdimg_" + Key);
                                                                if (sageDiv != null && BDimg != null)
                                                                {
                                                                   
                                                                    BDimg.ImageUrl = "";//GetTemplateImageUrl("imgedit.png", true); //this.Page.ResolveUrl(CurrentPath); ;
                                                                    sageDiv.Visible = false;
                                                                    //BDimg.Visible = true;
                                                                    //BDimg.Width = 200;
                                                                    //BDimg.Height = 200;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }

                                                #endregion
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }

                    #endregion
                }
                else
                {
                    //Clear Form Data.
                    #region "Loop Section For Clear"

                    foreach (Control cont in pnlForm.Controls)
                    {
                        if (cont.GetType() == typeof(Table))
                        {
                            foreach (Control pnlCon1 in cont.Controls)
                            {
                                if (pnlCon1.GetType() == typeof(TableRow))
                                {
                                    foreach (Control pnlCon2 in pnlCon1.Controls)
                                    {
                                        if (pnlCon2.GetType() == typeof(TableCell))
                                        {
                                            foreach (Control pnlCon3 in pnlCon2.Controls)
                                            {
                                                #region "Data Sections For Clear"
                                                //TextBox
                                                if (pnlCon3.GetType() == typeof(TextBox))
                                                {
                                                    TextBox txt = (TextBox)pnlCon3;
                                                    if (txt != null)
                                                    {
                                                        string conID = txt.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            txt.Text = "";                                                            
                                                        }
                                                    }
                                                }
                                                //DropDownList
                                                if (pnlCon3.GetType() == typeof(DropDownList))
                                                {
                                                    DropDownList ddl = (DropDownList)pnlCon3;
                                                    if (ddl != null)
                                                    {
                                                        string conID = ddl.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (ddl.Items.Count > 0)
                                                            {
                                                                ddl.SelectedIndex = 0;
                                                            }                                                           
                                                        }
                                                    }
                                                }
                                                //CheckBoxList
                                                if (pnlCon3.GetType() == typeof(CheckBoxList))
                                                {
                                                    CheckBoxList chbl = (CheckBoxList)pnlCon3;
                                                    if (chbl != null)
                                                    {
                                                        string conID = chbl.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (chbl.Items.Count > 0)
                                                            {
                                                                chbl.SelectedIndex = 0;
                                                            }                                                            
                                                        }
                                                    }
                                                }
                                                //RadioButtonList
                                                if (pnlCon3.GetType() == typeof(RadioButtonList))
                                                {
                                                    RadioButtonList rdbl = (RadioButtonList)pnlCon3;
                                                    if (rdbl != null)
                                                    {
                                                        string conID = rdbl.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            if (rdbl.Items.Count > 0)
                                                            {
                                                                rdbl.SelectedIndex = 0;
                                                            }                                                            
                                                        }
                                                    }
                                                }

                                                //FileUpload
                                                if (pnlCon3.GetType() == typeof(FileUpload))
                                                {
                                                    FileUpload asFlu = (FileUpload)pnlCon3;
                                                    if (asFlu != null)
                                                    {
                                                        string conID = asFlu.ID;
                                                        string[] IDColl = conID.Split("_".ToCharArray());
                                                        if (IDColl.Length > 0)
                                                        {
                                                            string Key = IDColl[1].ToString();
                                                            //if (htProfile.ContainsKey(Key))
                                                            //{
                                                                //System.Web.UI.HtmlControls.HtmlGenericControl gcDiv = new HtmlGenericControl("div");
                                                                //gcDiv.ID = "BDDiv_" + ProfileID;
                                                                HtmlGenericControl sageDiv = (HtmlGenericControl)pnlCon2.FindControl("BDDiv_" + Key);
                                                                Image BDimg = (Image)sageDiv.FindControl("Bdimg_" + Key);
                                                                if (sageDiv != null && BDimg != null)
                                                                {
                                                                    //string ImageName = htProfile[Key].ToString();
                                                                    //string MapPath = "~/Modules/Admin/UserManagement/ProfileImage/MediumProfileImage/";
                                                                    //string CurrentPath = MapPath + ImageName;
                                                                    BDimg.ImageUrl = "";//GetTemplateImageUrl("imgedit.png", true); //this.Page.ResolveUrl(CurrentPath); ;
                                                                    sageDiv.Visible = false;
                                                                    //BDimg.Visible = true;
                                                                    //BDimg.Width = 200;
                                                                    //BDimg.Height = 200;
                                                                }
                                                            //}
                                                        }
                                                    }
                                                }

                                                #endregion
                                            }
                                        }

                                    }
                                }
                            }
                        }
                    }

                    #endregion
                }

                #endregion
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 15
0
        protected void imgSave_Click(object sender, EventArgs e)
        {
            try
            {
                string value                     = txtEntryValue.Text;
                string text                      = txtEntryText.Text;
                string currencyCode              = txtCurrencyCode.Text.Trim();
                string displayLocale             = txtDisplayLocale.Text.Trim();
                string createdBy                 = GetUsername;
                bool   isActive                  = false;
                ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                if (chkActive.Checked == true)
                {
                    isActive = true;
                }

                if (ViewState["NEWLIST"] != null)
                {
                    ViewState["NEWLIST"] = null;
                    AddNewList();
                }
                else if (ViewState["LISTNAME"] != null && ViewState["ADDSUBLIST"] != null)
                {
                    ViewState["ADDSUBLIST"] = null;
                    string listName     = ViewState["LISTNAME"].ToString();
                    int    parentId     = 0;
                    int    level        = 0;
                    int    definitionId = -1;
                    int    portalId     = -1;
                    bool   displayOrder = true;
                    if (ViewState["PARENTKEY"] != null)
                    {
                        var getListDetail = dbList.sp_GetListEntriesByNameParentKeyAndPortalID(listName, ViewState["PARENTKEY"].ToString(), -1, GetCurrentCultureName);
                        foreach (sp_GetListEntriesByNameParentKeyAndPortalIDResult listDetail in getListDetail)
                        {
                            parentId     = listDetail.ParentID;
                            level        = listDetail.LEVEL;
                            definitionId = listDetail.DefinitionID;
                            portalId     = listDetail.PortalID;
                        }
                    }
                    try
                    {
                        var insertList = dbList.sp_ListEntryAdd(listName, value, text, parentId, level, currencyCode, displayLocale, displayOrder, definitionId, "", portalId, isActive, createdBy, GetCurrentCultureName);

                        ViewMode();
                        BindGrid(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString());
                    }
                    catch (Exception ex)
                    {
                        ProcessException(ex);
                    }
                }
                else if (ViewState["LISTNAME"] != null && ViewState["ENTRYID"] != null)
                {
                    int entryId = int.Parse(ViewState["ENTRYID"].ToString());
                    ViewState["ENTRYID"] = null;
                    try
                    {
                        var updateList = dbList.sp_ListEntryUpdate(entryId, value, text, currencyCode, displayLocale, "", isActive, createdBy, GetCurrentCultureName);

                        ViewMode();
                        BindGrid(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString());
                    }
                    catch (Exception ex)
                    {
                        ProcessException(ex);
                    }
                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 16
0
        private void GenrateForm()
        {
            try
            {
                if (pnlForm.Controls.Count == 1)
                {
                    var LINQProfile = db.sp_ProfileListActive(GetPortalID);
                    CommonFunction LToDCon = new CommonFunction();
                    DataTable dt = LToDCon.LINQToDataTable(LINQProfile);
                    if (dt != null && dt.Rows.Count > 0)
                    {
                        Table tblSageForm = new Table();
                        tblSageForm.CssClass = "cssClassForm";
                        tblSageForm.ID = "tblSageForm";
                        tblSageForm.EnableViewState = true;
                        string parentKey = string.Empty;
                        for (int i = 0; i < dt.Rows.Count; i++)
                        {
                            int ProfileID = Int32.Parse(dt.Rows[i]["ProfileID"].ToString());
                            TableRow tbrSageRow = new TableRow();
                            tbrSageRow.ID = "tbrSageRow_" + ProfileID;
                            tbrSageRow.EnableViewState = true;

                            TableCell tcleftSagetd = new TableCell();
                            tcleftSagetd.ID = "tcleftSagetd_" + ProfileID;
                            tcleftSagetd.CssClass = "cssClassFormtdLleft";
                            tcleftSagetd.EnableViewState = true;
                            tcleftSagetd.Width = Unit.Percentage(20);

                            Label lblValue = new Label();
                            lblValue.ID = "lblValue_" + ProfileID;
                            lblValue.Text = dt.Rows[i]["Name"].ToString();
                            lblValue.ToolTip = dt.Rows[i]["Name"].ToString();
                            lblValue.EnableViewState = true;
                            lblValue.CssClass = "cssClassFormLabel";

                            tcleftSagetd.Controls.Add(lblValue);

                            tbrSageRow.Cells.Add(tcleftSagetd);

                            
                            int PropertyTypeID = Int32.Parse(dt.Rows[i]["PropertyTypeID"].ToString());

                            TableCell tcrightSagetd = new TableCell();
                            tcrightSagetd.ID = "tcrightSagetd_" + ProfileID;
                            tcrightSagetd.CssClass = "cssClassFormtdRight";
                            tcrightSagetd.EnableViewState = true;

                            
                            

                            switch (PropertyTypeID)
                            {
                                case 1://TextBox
                                    TextBox BDTextBox = new TextBox();
                                    BDTextBox.ID = "BDTextBox_" + ProfileID;
                                    BDTextBox.CssClass = "cssClassNormalTextBox";
                                    BDTextBox.EnableViewState = true;



                                    int DataType = Int32.Parse(dt.Rows[i]["DataType"].ToString());
                                    switch (DataType)
                                    {
                                        case 0://String
                                            //Adding in Pandel
                                            tcrightSagetd.Controls.Add(BDTextBox);
                                            break;
                                        case 1://Integer
                                            BDTextBox.Attributes.Add("OnKeydown", "return NumberKey(event)");
                                            //Adding in Pandel
                                            tcrightSagetd.Controls.Add(BDTextBox);
                                            break;
                                        case 2://Decimal
                                            BDTextBox.Attributes.Add("OnKeydown", "return NumberKeyWithDecimal(event)");
                                            //Adding in Pandel
                                            tcrightSagetd.Controls.Add(BDTextBox);
                                            break;
                                        case 3://DateTime
                                            ImageButton imb = new ImageButton();
                                            imb.ID = "imb_" + ProfileID;
                                            imb.ImageUrl = GetTemplateImageUrl("imgcalendar.png", true);

                                            CalendarExtender Cex = new CalendarExtender();
                                            Cex.ID = "Cex_" + ProfileID;
                                            Cex.TargetControlID = BDTextBox.ID;
                                            Cex.PopupButtonID = imb.ID;
                                            Cex.SelectedDate = DateTime.Now;
                                            BDTextBox.ToolTip = "DateTime";
                                            BDTextBox.Enabled = false;

                                            //Adding in Panel
                                            tcrightSagetd.Controls.Add(BDTextBox);
                                            tcrightSagetd.Controls.Add(imb);
                                            tcrightSagetd.Controls.Add(Cex);
                                            break;

                                    }

                                    

                                    bool IsRequred = bool.Parse(dt.Rows[i]["IsRequired"].ToString());
                                    if (IsRequred)
                                    {
                                        RequiredFieldValidator rfv = new RequiredFieldValidator();
                                        rfv.ID = "rfv_" + ProfileID;
                                        rfv.ControlToValidate = BDTextBox.ID;
                                        rfv.ErrorMessage = "*";
                                        rfv.ValidationGroup = "UserProfile";
                                        tcrightSagetd.Controls.Add(rfv);
                                    }
                                    

                                    break;
                                case 2://DropDownList
                                    DropDownList ddl = new DropDownList();
                                    ddl.ID = "BDTextBox_" + ProfileID;
                                    ddl.CssClass = "cssClassDropDown";
                                    //ddl.Width = 200;
                                    ddl.EnableViewState = true;

                                    //Setting Data Source
                                    var LinqProvileValue = db.sp_ProfileValueGetActiveByProfileID(ProfileID, GetPortalID);
                                    ddl.DataSource = LinqProvileValue;
                                    ddl.DataValueField = "ProfileValueID";
                                    ddl.DataTextField = "Name";
                                    ddl.DataBind();
                                    if (ddl.Items.Count > 0)
                                    {
                                        ddl.SelectedIndex = 0;
                                    }

                                    //Adding in Pandel
                                    tcrightSagetd.Controls.Add(ddl);
                                    break;
                                case 3://CheckBoxList
                                    CheckBoxList chbl = new CheckBoxList();
                                    chbl.ID = "BDTextBox_" + ProfileID;
                                    chbl.CssClass = "cssClassCheckBox";
                                    chbl.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                                    chbl.RepeatColumns = 2;
                                    chbl.EnableViewState = true;

                                    //Setting Data Source
                                    LinqProvileValue = db.sp_ProfileValueGetActiveByProfileID(ProfileID, GetPortalID);
                                    chbl.DataSource = LinqProvileValue;
                                    chbl.DataValueField = "ProfileValueID";
                                    chbl.DataTextField = "Name";
                                    chbl.DataBind();
                                    if (chbl.Items.Count > 0)
                                    {
                                        chbl.SelectedIndex = 0;
                                    }

                                    //Adding in Pandel
                                    tcrightSagetd.Controls.Add(chbl);
                                    break;
                                case 4://RadioButtonList
                                    RadioButtonList rdbl = new RadioButtonList();
                                    rdbl.ID = "BDTextBox_" + ProfileID;
                                    rdbl.CssClass = "cssClassRadioButtonList";
                                    rdbl.EnableViewState = true;
                                    rdbl.RepeatDirection = System.Web.UI.WebControls.RepeatDirection.Horizontal;
                                    rdbl.RepeatColumns = 2;

                                    //Setting Data Source
                                    LinqProvileValue = db.sp_ProfileValueGetActiveByProfileID(ProfileID, GetPortalID);
                                    rdbl.DataSource = LinqProvileValue;
                                    rdbl.DataValueField = "ProfileValueID";
                                    rdbl.DataTextField = "Name";
                                    rdbl.DataBind();
                                    if (rdbl.Items.Count > 0)
                                    {
                                        rdbl.SelectedIndex = 0;
                                    }
									tcrightSagetd.CssClass = "cssClassButtonListWrapper";
                                    //Adding in Pandel
                                    tcrightSagetd.Controls.Add(rdbl);
                                    break;
                                case 5://DropDownList
                                    DropDownList cddl = new DropDownList();
                                    cddl.ID = "BDTextBox_" + ProfileID;
                                    cddl.CssClass = "cssClassDropDown";
                                    //cddl.Width = 200;
                                    cddl.EnableViewState = true;
                                    cddl.SelectedIndexChanged +=new EventHandler(cddl_SelectedIndexChanged);
                                    cddl.AutoPostBack = true;
                                    ViewState["cddlID"] = cddl.ID;
                                    //Setting Data Source
                                    ListManagementDataContext cdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                                    var CLINQ = cdb.sp_GetListEntrybyNameAndID("Country", -1,GetCurrentCultureName);                                   
                                    cddl.DataSource = CLINQ;
                                    cddl.DataValueField = "Value";
                                    cddl.DataTextField = "Text";
                                    cddl.DataBind();
                                    if (cddl.Items.Count > 0)
                                    {
                                        cddl.SelectedIndex = 0;
                                        parentKey = "Country." + cddl.SelectedItem.Value;
                                    }

                                    //Adding in Pandel
                                    tcrightSagetd.Controls.Add(cddl);
                                    break;
                                case 6://DropDownList
                                    DropDownList Sddl = new DropDownList();
                                    Sddl.ID = "BDTextBox_" + ProfileID;
                                    Sddl.CssClass = "cssClassNormalTextBox";
                                    //Sddl.Width = 200;
                                    Sddl.EnableViewState = true;
                                    ViewState["SddlID"] = Sddl.ID;
                                    //Setting Data Source
                                    string listName = "Region";
                                    ListManagementDataContext Sdb = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                                    var listDetail = Sdb.sp_GetListEntriesByNameParentKeyAndPortalID(listName, parentKey, -1,GetCurrentCultureName);
                                    Sddl.DataSource = listDetail;
                                    Sddl.DataValueField = "Value";
                                    Sddl.DataTextField = "Text";
                                    Sddl.DataBind();
                                    if (Sddl.Items.Count > 0)
                                    {
                                        Sddl.SelectedIndex = 0;
                                    }
                                    ViewState["StateRow"] = tbrSageRow.ID;

                                    //Adding in Pandel
                                    tcrightSagetd.Controls.Add(Sddl);
                                    break;
                                case 7://DropDownList
                                    DropDownList TimeZoneddl = new DropDownList();
                                    TimeZoneddl.ID = "BDTextBox_" + ProfileID;
                                    TimeZoneddl.CssClass = "cssClassDropDown";
                                    //TimeZoneddl.Width = 200;
                                    TimeZoneddl.EnableViewState = true;

                                    //Setting Data Source
                                    NameValueCollection nvlTimeZone = SageFrame.Localization.Localization.GetTimeZones(((PageBase)this.Page).GetCurrentCultureName);
                                    TimeZoneddl.DataSource = nvlTimeZone;                                    
                                    TimeZoneddl.DataBind();
                                    if (TimeZoneddl.Items.Count > 0)
                                    {
                                        TimeZoneddl.SelectedIndex = 0;                                       
                                    }

                                    //Adding in Pandel
                                    tcrightSagetd.Controls.Add(TimeZoneddl);
                                    break;
                                case 8://File Upload
                                    FileUpload AsyFlu = new FileUpload();
                                    AsyFlu.ID = "BDTextBox_" + ProfileID;
                                    AsyFlu.CssClass = "cssClassNormalFileUpload";                                    
                                    AsyFlu.EnableViewState = true;
                                    tcrightSagetd.Controls.Add(AsyFlu);

                                    System.Web.UI.HtmlControls.HtmlGenericControl gcDiv = new HtmlGenericControl("div");
                                    gcDiv.ID = "BDDiv_" + ProfileID;
                                    gcDiv.Attributes.Add("class","cssClassProfileImageWrapper");
                                    gcDiv.EnableViewState = true;
                                    gcDiv.Visible = false;

                                    Image img = new Image();
                                    img.ID = "Bdimg_" + ProfileID;
                                    img.CssClass = "cssClassProfileImage";
                                    img.EnableViewState = true;
                                    gcDiv.Controls.Add(img);
                                    tcrightSagetd.Controls.Add(gcDiv);
                                    break;
                            }
                            tbrSageRow.Cells.Add(tcrightSagetd);
                            tblSageForm.Rows.Add(tbrSageRow);
                            pnlForm.Controls.Add(tblSageForm);
                        }
                    }
                }

            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }
Esempio n. 17
0
        protected void imgSave_Click(object sender, EventArgs e)
        {
            try
            {
                string value = txtEntryValue.Text;
                string text = txtEntryText.Text;
                string currencyCode = txtCurrencyCode.Text.Trim();
                string displayLocale = txtDisplayLocale.Text.Trim();
                string createdBy = GetUsername;
                bool isActive = false;
                ListManagementDataContext dbList = new ListManagementDataContext(SystemSetting.SageFrameConnectionString);
                if (chkActive.Checked == true)
                {
                    isActive = true;
                }

                if (ViewState["NEWLIST"] != null)
                {
                    ViewState["NEWLIST"] = null;
                    AddNewList();
                }
                else if (ViewState["LISTNAME"] != null && ViewState["ADDSUBLIST"] != null)
                {
                    ViewState["ADDSUBLIST"] = null;
                    string listName = ViewState["LISTNAME"].ToString();
                    int parentId = 0;
                    int level = 0;
                    int definitionId = -1;
                    int portalId = -1;
                    bool displayOrder = true;
                    if (ViewState["PARENTKEY"] != null)
                    {
                        var getListDetail = dbList.sp_GetListEntriesByNameParentKeyAndPortalID(listName, ViewState["PARENTKEY"].ToString(), -1,GetCurrentCultureName);
                        foreach (sp_GetListEntriesByNameParentKeyAndPortalIDResult listDetail in getListDetail)
                        {
                            parentId = listDetail.ParentID;
                            level = listDetail.LEVEL;
                            definitionId = listDetail.DefinitionID;
                            portalId = listDetail.PortalID;
                        }
                    }
                    try
                    {
                        var insertList = dbList.sp_ListEntryAdd(listName, value, text, parentId, level, currencyCode, displayLocale, displayOrder, definitionId, "", portalId, isActive, createdBy,GetCurrentCultureName);

                        ViewMode();
                        BindGrid(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString());
                    }
                    catch (Exception ex)
                    {
                        ProcessException(ex);
                    }
                }
                else if (ViewState["LISTNAME"] != null && ViewState["ENTRYID"] != null)
                {

                    int entryId = int.Parse(ViewState["ENTRYID"].ToString());
                    ViewState["ENTRYID"] = null;
                    try
                    {
                        var updateList = dbList.sp_ListEntryUpdate(entryId, value, text, currencyCode, displayLocale, "", isActive, createdBy,GetCurrentCultureName);

                        ViewMode();
                        BindGrid(ViewState["LISTNAME"].ToString(), ViewState["PARENTKEY"].ToString());
                    }
                    catch (Exception ex)
                    {
                        ProcessException(ex);
                    }

                }
            }
            catch (Exception ex)
            {
                ProcessException(ex);
            }
        }