Esempio n. 1
0
        private void ShowSysField(int _channel_id)
        {
            //查找该频道所选的默认字段
            List <Model.article_attribute_field> ls = new BLL.article_attribute_field().GetModelList(this.channel_id, "is_sys=1");

            foreach (Model.article_attribute_field modelt in ls)
            {
                //查找相应的控件,如找到则显示
                HtmlGenericControl htmlDiv = FindControl("div_" + modelt.name) as HtmlGenericControl;
                if (htmlDiv != null)
                {
                    htmlDiv.Visible = true;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_title")).Text  = modelt.title;
                    ((TextBox)htmlDiv.FindControl("field_control_" + modelt.name)).Text = modelt.default_value;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip")).Text    = modelt.valid_tip_msg;
                }
            }
            //查找该频道所开启的功能
            //Model.channel channelModel = new BLL.channel().GetModel(_channel_id);
            //if (channelModel.is_albums == 1)
            //{
            //    div_albums_container.Visible = true;
            //}
            //if (channelModel.is_attach == 1)
            //{
            //    div_attach_container.Visible = true;
            //}
            //if (channelModel.is_group_price == 1)
            //{

            //}
        }
Esempio n. 2
0
        private void ShowSysField(int _channel_id)
        {
            //查找该频道所选的默认字段
            List <Model.article_attribute_field> ls = new BLL.article_attribute_field().GetModelList(this.channel_id, "is_sys=1");

            foreach (Model.article_attribute_field modelt in ls)
            {
                string[] strs = new string[] { "PurchasePrice", "WholesalePrice", "SpecialPrice", "PriceMode" };
                bool     b    = false;
                foreach (string str in strs)
                {
                    if (str == modelt.name)
                    {
                        b = true;
                    }
                }
                if (b)
                {
                    continue;
                }
                //查找相应的控件,如找到则显示
                HtmlGenericControl htmlDiv = FindControl("div_" + modelt.name) as HtmlGenericControl;
                if (htmlDiv != null)
                {
                    htmlDiv.Visible = true;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_title")).Text  = modelt.title;
                    ((TextBox)htmlDiv.FindControl("field_control_" + modelt.name)).Text = modelt.default_value;
                    if ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip") != null)
                    {
                        ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip")).Text = modelt.valid_tip_msg;
                    }
                }
            }
            //查找该频道所开启的功能
            Model.channel channelModel = new BLL.channel().GetModel(_channel_id);
            if (channelModel.is_albums == 1)
            {
                div_albums_container.Visible = true;
            }
            if (channelModel.is_attach == 1)
            {
                div_attach_container.Visible = true;
            }
            if (channelModel.is_group_price == 1)
            {
            }

            if (_channel_id == 2)
            {
                PPTreeBind(); //绑定商品品牌
                ModeBind();   //绑定价格模式
                div_price.Visible = true;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// During binding, bind sub menus to group attribute
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void BindSubMenu(object sender, RepeaterItemEventArgs e)
        {
            string             disease     = e.Item.DataItem.ToString();
            HtmlGenericControl subMenu     = e.Item.FindControl("SubMenuList") as HtmlGenericControl;
            Repeater           subMenuRptr = subMenu.FindControl("PaperFormsSubMenu") as Repeater;

            var childMenus = from config in PaperFormNodes
                             where config.Disease == disease
                             select config;

            // bind sub menus to nodes which mactch current top level menu disease
            subMenuRptr.DataSource = childMenus;
            subMenuRptr.DataBind();

            // After binding sub menu items, adjust width of submenu to fit items
            Repeater mainMenu     = sender as Repeater;
            int      minMenuWidth = 1;

            // Loop through bound sub menu items and determine longest text
            foreach (RepeaterItem subMenuItem in subMenuRptr.Items)
            {
                HyperLink subMenuLink = subMenuItem.FindControl("SubMenuLink") as HyperLink;
                string    formName    = subMenuLink.Text;
                int       textWidth   = (formName.Length / 2) + 1;
                minMenuWidth = Math.Max(textWidth, minMenuWidth);
            }
            subMenu.Style["width"] = minMenuWidth + "em";
        }
Esempio n. 4
0
        /// -=======-=======-=======-=======-=======-=======-=======-=======-=======-=======-=======-=======-=======-
        ///
        /// <summary>
        /// will utilize the divMessage on the asp page
        /// </summary>
        /// <param name="divMessage">here you should pass the div</param>
        /// <param name="message">here should be the message text</param>
        /// <param name="messageType">E: Error; S: Success, I: Info, EmptyOrNull: Hide the message</param>
        public static void ShowMessage(HtmlGenericControl divMessage, string message, string messageType, string ltrControlID = "ltrMsg")
        {
            Literal ltrMsg = divMessage.FindControl(ltrControlID) as Literal;

            if (string.IsNullOrEmpty(messageType))
            {
                divMessage.Visible = false;
            }
            else
            {
                divMessage.Visible = true;
                ltrMsg.Text        = message;
                divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString().Replace("alert-danger", ""));
                divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString().Replace("alert-info", ""));
                divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString().Replace("alert-success", ""));

                if (messageType == "S")
                {
                    divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString() + " alert-success");
                }
                else if (messageType == "E")
                {
                    divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString() + " alert-danger");
                }
                else if (messageType == "W")
                {
                    divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString() + " alert-warning");
                }
                else
                {
                    divMessage.Attributes.Add("class", divMessage.Attributes["class"].ToString() + " alert-info");
                }
            }
        }
Esempio n. 5
0
 protected void FillStars(HtmlGenericControl control, int rating)
 {
     for (var i = 1; i <= rating; i++)
     {
         var star = (HtmlGenericControl)control.FindControl("star" + i);
         if (star != null)
         {
             star.InnerHtml = "<i class=\"material-icons\">star</i>";
             star.Attributes.Add("class", "star star-filled");
         }
     }
 }
Esempio n. 6
0
        private void ShowSysField(int _channel_id)
        {
            //查找该频道所选的默认字段
            List <Model.article_attribute_field> ls = new BLL.article_attribute_field().GetModelList(this.channel_id, "is_sys=1");

            if (ls.Count > 0)
            {
                field_tab_item.Visible    = true;
                field_tab_content.Visible = true;
            }
            foreach (Model.article_attribute_field modelt in ls)
            {
                //查找相应的控件,如找到则显示
                HtmlGenericControl htmlDiv = FindControl("div_" + modelt.name) as HtmlGenericControl;
                if (htmlDiv != null)
                {
                    htmlDiv.Visible = true;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_title")).Text  = modelt.title;
                    ((TextBox)htmlDiv.FindControl("field_control_" + modelt.name)).Text = modelt.default_value;
                    ((Label)htmlDiv.FindControl("div_" + modelt.name + "_tip")).Text    = modelt.valid_tip_msg;
                }
            }
        }
Esempio n. 7
0
 private void ShowSysField(int _channel_id)
 {
     foreach (Rain.Model.article_attribute_field model in new Rain.BLL.article_attribute_field().GetModelList(this.channel_id, "is_sys=1"))
     {
         HtmlGenericControl control = this.FindControl("div_" + model.name) as HtmlGenericControl;
         if (control != null)
         {
             control.Visible = true;
             ((Label)control.FindControl("div_" + model.name + "_title")).Text  = model.title;
             ((TextBox)control.FindControl("field_control_" + model.name)).Text = model.default_value;
             ((Label)control.FindControl("div_" + model.name + "_tip")).Text    = model.valid_tip_msg;
         }
     }
     Rain.Model.channel model1 = new Rain.BLL.channel().GetModel(_channel_id);
     if (model1.is_albums == 1)
     {
         this.div_albums_container.Visible = true;
     }
     if (model1.is_attach != 1)
     {
         return;
     }
     this.div_attach_container.Visible = true;
 }
Esempio n. 8
0
        /// <summary>
        /// Binds the data.
        /// </summary>
        private void bindData()
        {
            IEnumerable <SearchResultItem> results = FindSimilar();
            var foundHeader = LeftColumn.FindControl("foundHeader") as HtmlGenericControl;

            foundHeader.Visible = true;
            if (results.Count() != 0)
            {
                foundHeader.InnerText = string.Format(SimilarityResources.lbl_items_found, results.Count());
            }
            else
            {
                foundHeader.InnerText = SimilarityResources.lbl_no_items_found;
            }

            SearchResults.DataSource = results;
            SearchResults.DataBind();
        }
Esempio n. 9
0
        public void ValidaMascaraCaptura()
        {
            try
            {
                Encuesta encuesta = (Encuesta)Session["EncuestaActiva"];
                switch (encuesta.IdTipoEncuesta)
                {
                case (int)BusinessVariables.EnumTipoEncuesta.Logica:
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.Calificacion:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                if (!divGrupo.Controls.Cast <Control>().Any(control => ((RadioButton)control).Checked))
                                {
                                    throw new Exception("Debe contestar todas las pregunats");
                                }
                            }
                        }
                    }
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.OpcionMultiple:
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
    protected void SaveNotes(object sender, EventArgs e)
    {
        RadButton          rb_ss_notes = (RadButton)sender;
        GridDataItem       gdi         = (GridDataItem)rb_ss_notes.Parent.Parent.Parent;
        HtmlGenericControl div_notes   = (HtmlGenericControl)rb_ss_notes.Parent.Parent.FindControl("div_notes");
        String             cpy_id      = gdi["feat_cpy_id"].Text;
        RadTextBox         tb_ss_notes = (RadTextBox)div_notes.FindControl("tb_ss_notes");

        ram.AjaxSettings.AddAjaxSetting(rb_ss_notes, div_notes); // re-ajaxify the div

        String notes = tb_ss_notes.Text.Trim();

        if (notes == String.Empty)
        {
            notes = null;
        }
        String uqry = "UPDATE db_smartsocialstatus SET SmartSocialNotes=@n WHERE CompanyID=@CompanyID AND Issue=@Issue";

        SQL.Update(uqry,
                   new String[] { "@CompanyID", "@n", "@Issue" },
                   new Object[] { cpy_id, notes, dd_issue.SelectedItem.Text });

        Util.PageMessageSuccess(this, "Notes saved!");
    }
    protected void rg_features_ItemDataBound(object sender, GridItemEventArgs e)
    {
        if (e.Item is GridNestedViewItem)
        {
            GridNestedViewItem nested_item = (GridNestedViewItem)e.Item;
            String             feat_cpy_id = ((HiddenField)nested_item.FindControl("hf_feat_cpy_id")).Value;
            System.Web.UI.HtmlControls.HtmlIframe iframe = ((System.Web.UI.HtmlControls.HtmlIframe)nested_item.FindControl("if_ltmpl"));
            if (dd_issue.Items.Count > 0 && dd_issue.SelectedItem != null)
            {
                iframe.Attributes.Add("src", "trackeradvertiserlist.aspx?feat_cpy_id=" + feat_cpy_id + "&issue_name=" + dd_issue.SelectedItem.Text);
                //src='<%#: String.Format(("trackeradvertiserlist.aspx?feat_cpy_id={0}"), Eval("feat_cpy_id")) %>' // for aspx
                iframe.Attributes.Add("onload", "resizeIframe(this);");
            }
        }
        else if (e.Item is GridDataItem)
        {
            GridDataItem item   = (GridDataItem)e.Item;
            String       cpy_id = item["feat_cpy_id"].Text;

            // View Company
            LinkButton lb = (LinkButton)item["Feature"].FindControl("lb_view_cpy");
            lb.OnClientClick = "radopen('trackercompanycontacteditor.aspx?cpy_id=" + Server.UrlEncode(cpy_id) + "&cpy_type=f&issue=" + Server.UrlEncode(dd_issue.SelectedItem.Text) + "', 'rw_ss_editor'); return false;";
            lb.Text          = Server.HtmlEncode(Util.TruncateText(Server.HtmlDecode(lb.Text), 30));

            if (item["Region"].Text == "&nbsp;")
            {
                item.Display = false;
                //item.Attributes.Add("style", "background-color:#363636; height:20px !important;");
                //item.CssClass = "bottomLine " + (item.ItemIndex % 2 == 0 ? "rgRow" : "rgAltRow");
                //div.RadGrid tr.bottomLine td {
                //border-bottom: 1px solid red;
                //}
            }

            //// Completeness Indicators (for widget/brochure/twitter etc)
            //String[] Indications = new String[] { "Widget", "Brochure", "Infographics", "WebCopy", "SampleTweets"};
            //foreach (String i in Indications)
            //{
            //    ImageButton imbtn_s = (ImageButton)item[i].FindControl("imbtn_"+i);
            //    HtmlGenericControl div = (HtmlGenericControl)item[i].FindControl("div_" + i);
            //    ram.AjaxSettings.AddAjaxSetting(div, div); // ajaxify the div
            //    if (imbtn_s.CommandName == "Y")
            //        imbtn_s.ImageUrl = "~/images/smartsocial/ico_tick.png";
            //    else
            //        imbtn_s.ImageUrl = "~/images/smartsocial/ico_cross.png";
            //}

            // Shared Indicators
            String[] ShareIndications = new String[] { "twitter", "facebook", "linkedin", "website", "other" };
            foreach (String i in ShareIndications)
            {
                ImageButton        imbtn_s = (ImageButton)item[i].FindControl("imbtn_so_" + i);
                HtmlGenericControl div     = (HtmlGenericControl)item[i].FindControl("div_so_" + i);
                ram.AjaxSettings.AddAjaxSetting(div, div); // ajaxify the div
                if (imbtn_s.CommandName == "1")
                {
                    imbtn_s.ImageUrl = "~/images/smartsocial/ico_tick.png";
                }
                else
                {
                    imbtn_s.ImageUrl = "~/images/smartsocial/ico_cross.png";
                }
            }

            // Truncate writer
            int   WriterTrunc = 8;
            Label lbl_editor  = (Label)item["Editor"].FindControl("lbl_editor");
            if (lbl_editor.Text != String.Empty && lbl_editor.Text.Length > WriterTrunc)
            {
                RadToolTip rtt_editor = (RadToolTip)item["Editor"].FindControl("rtt_editor");
                lbl_editor.Text = HttpUtility.HtmlEncode(Util.TruncateText(HttpUtility.HtmlDecode(lbl_editor.Text), WriterTrunc));
            }

            // Truncate/tooltip mags
            int   MagTrunc = 10;
            Label lbl_rm   = (Label)item["RegionMag"].FindControl("lbl_rm");
            if (lbl_rm.Text != String.Empty && lbl_rm.Text.Length > MagTrunc)
            {
                RadToolTip rtt_rm = (RadToolTip)item["RegionMag"].FindControl("rtt_rm");
                lbl_rm.Text = HttpUtility.HtmlEncode(Util.TruncateText(HttpUtility.HtmlDecode(lbl_rm.Text), MagTrunc));
            }

            Label lbl_sm = (Label)item["SectorMag"].FindControl("lbl_sm");
            if (lbl_sm.Text != String.Empty && lbl_sm.Text.Length > MagTrunc)
            {
                RadToolTip rtt_sm = (RadToolTip)item["SectorMag"].FindControl("rtt_sm");
                lbl_sm.Text = HttpUtility.HtmlEncode(Util.TruncateText(HttpUtility.HtmlDecode(lbl_sm.Text), MagTrunc));
            }

            // Notes
            RadButton          rb_ss_notes = (RadButton)item["Notes"].FindControl("rb_ss_notes");
            HtmlGenericControl div_notes   = (HtmlGenericControl)item["Notes"].FindControl("div_notes");
            RadTextBox         tb_ss_notes = (RadTextBox)div_notes.FindControl("tb_ss_notes");
            tb_ss_notes.ClientEvents.OnBlur = "function(sender, args){ $find('" + rb_ss_notes.ClientID + "').click(); }";
            ram.AjaxSettings.AddAjaxSetting(rb_ss_notes, div_notes); // ajaxify the div

            //// Case Studies
            //int CSTrunc = 16;
            //for (int i = 1; i < 6; i++)
            //{
            //    String UnqName = "cs" + i;
            //    if (item[UnqName].Text != "&nbsp;" && item[UnqName].Text.Length >= CSTrunc)
            //        Util.AddRadToolTipToRadGridCell(item[UnqName], true, CSTrunc);
            //}

            //// Notes tooltip
            //if (item["SSNotes"].Text != "&nbsp;")
            //    Util.AddRadToolTipToRadGridCell(item["SSNotes"], false, 0, "#dcfadc");

            // Add smartsocial button
            String SmartSocialPageParamID = item["SSParam"].Text;

            if (SmartSocialPageParamID != "&nbsp;" && dd_issue.Items.Count > 0 && dd_issue.SelectedItem != null)
            {
                //item["Feature"].BackColor = Color.FromName("#dcfadc");

                ImageButton imbtn_smartsocial = new ImageButton();
                //imbtn_smartsocial.ToolTip = "View the SMARTsocial profile for this feature.";
                imbtn_smartsocial.ImageUrl = "~/images/smartsocial/ico_logo_alpha.png";
                imbtn_smartsocial.Height   = 16;
                imbtn_smartsocial.Width    = 16;
                imbtn_smartsocial.Style.Add("margin-left", "2px");
                imbtn_smartsocial.Style.Add("border-bottom", "solid 1px green;");

                // Set language param
                String language = String.Empty;
                if (dd_region.Items.Count > 0 && dd_region.SelectedItem != null)
                {
                    switch (dd_region.SelectedItem.Text)
                    {
                    case "Brazil": language = "&l=p"; break;

                    case "Latin America": language = "&l=s"; break;
                    }
                }

                imbtn_smartsocial.OnClientClick = "window.open('/dashboard/smartsocial/project.aspx?ss=" + SmartSocialPageParamID +
                                                  language + "&iss=" + dd_issue.SelectedItem.Text + "','_newtab'); return false;";
                item["SSProfile"].Controls.Add(imbtn_smartsocial);

                RadToolTip rtt_view_ss = (RadToolTip)item["SSProfile"].FindControl("rtt_ss_view");
                rtt_view_ss.TargetControlID = imbtn_smartsocial.ClientID;
            }
        }
    }
        private Control CreateRelatedList()
        {
            var ContainerDiv = new HtmlGenericControl("div")
            {
                ID = "ListAttributeContainer"
            };

            ContainerDiv.Visible = DisplayRelatedList;


#warning Style for RelatedList.
            ContainerDiv.Attributes.Add("class", "ListAttributeContainer");

            var toolBarDiv = new HtmlGenericControl("div");
            toolBarDiv.Attributes.Add("class", "ListAttributeContent");

            RelatedListView = new GridView
            {
                ID                  = "ListView",
                DataKeyNames        = new[] { "objID" },
                AutoGenerateColumns = true,
                UseAccessibleHeader = true
            };

            RelatedListView.RowDataBound         += RelatedListView_RowDataBound;
            RelatedListView.SelectedIndexChanged += RelatedListView_SelectedIndexChanged;



            if (DisplayRelatedList)
            {
                var sourceTable = DataBaseReader.GetRelations(OpenedRelation);
                RelatedListView.DataSource = sourceTable;

                RelatedListView.DataBind();
            }

            var headerDiv = new HtmlGenericControl("div");

            headerDiv.Attributes.Add("class", "headDiv");

            var closeButton = new Button {
                Text = "Закрыть"
            };
            closeButton.Click += CloseRelatedListHandler;

            headerDiv.Controls.Add(closeButton);
            toolBarDiv.Controls.Add(headerDiv);

            var searchPanelDiv = CreateSearchPanel();
            toolBarDiv.Controls.Add(searchPanelDiv);

            var bodyDiv = new HtmlGenericControl("div");
            bodyDiv.Attributes.Add("class", "bodyDiv");

            bodyDiv.Controls.Add(RelatedListView);
            toolBarDiv.Controls.Add(bodyDiv);

            ContainerDiv.Controls.Add(toolBarDiv);


            Controls.Add(ContainerDiv);

            if (DisplayRelatedList)
            {
                ContainerDiv.FindControl("ListAttributeSearchText").Focus();
            }

            return(ContainerDiv);
        }
Esempio n. 13
0
        public int CreateReport(string reportId, string nameEn, string nameAr, string nameFr, string source,
                                string sourceAr, string sourceFr, string publishYear, string themes, string runningVariable,
                                string changingVariable
                                , string yearFrom, string yearTo, HtmlGenericControl mydiv)
        {
            SqlConnection con = new SqlConnection(ConnectionString12);

            SqlCommand cmd1      = new SqlCommand();
            string     insertsql = string.Empty;

            if (string.IsNullOrEmpty(reportId))
            {
                insertsql =
                    "insert into Reports (ReportEnName,ReportArName, ReportFrName,Source,SourceAr,SourceFr,PublishYear, ThemeID, RunningVariableID, ChangingVariableID";
            }
            else
            {
                insertsql =
                    "update  Reports set ReportEnName=@ReportEnName,ReportArName=@ReportArName, ReportFrName=@ReportFrName,Source=@Source,SourceAr=@SourceAr,SourceFr=@SourceFr,PublishYear=@PublishYear, ThemeID=@ThemeID, RunningVariableID=@RunningVariableID, ChangingVariableID=@ChangingVariableID";
            }
            ArabicPrepocessor strp = new ArabicPrepocessor();

            cmd1.Parameters.Clear();
            cmd1.Parameters.Add("ReportEnName", SqlDbType.NVarChar);
            cmd1.Parameters["ReportEnName"].Value = strp.StripArabicWords(nameEn);
            cmd1.Parameters.Add("ReportArName", SqlDbType.NVarChar);
            cmd1.Parameters["ReportArName"].Value = strp.StripArabicWords(nameAr);
            cmd1.Parameters.Add("ReportFrName", SqlDbType.NVarChar);
            cmd1.Parameters["ReportFrName"].Value = strp.StripArabicWords(nameFr);
            cmd1.Parameters.Add("Source", SqlDbType.NVarChar);
            cmd1.Parameters["Source"].Value = strp.StripArabicWords(source);
            cmd1.Parameters.Add("SourceAr", SqlDbType.NVarChar);
            cmd1.Parameters["SourceAr"].Value = strp.StripArabicWords(sourceAr);
            cmd1.Parameters.Add("SourceFr", SqlDbType.NVarChar);
            cmd1.Parameters["SourceFr"].Value = strp.StripArabicWords(sourceFr);
            cmd1.Parameters.Add("PublishYear", SqlDbType.Int);
            if (String.IsNullOrEmpty(publishYear))
            {
                cmd1.Parameters["PublishYear"].Value = DBNull.Value;
            }
            else
            {
                cmd1.Parameters["PublishYear"].Value = publishYear;
            }

            cmd1.Parameters.Add("ThemeID", SqlDbType.NVarChar);
            cmd1.Parameters["ThemeID"].Value = themes;
            cmd1.Parameters.Add("RunningVariableID", SqlDbType.NVarChar);
            if (runningVariable == "selected")
            {
                cmd1.Parameters["RunningVariableID"].Value = DBNull.Value;
            }
            else
            {
                cmd1.Parameters["RunningVariableID"].Value = runningVariable;
            }

            cmd1.Parameters.Add("ChangingVariableID", SqlDbType.NVarChar);
            cmd1.Parameters["ChangingVariableID"].Value = changingVariable;

            if (runningVariable == "004" || changingVariable == "004")
            {
                if (string.IsNullOrEmpty(reportId))
                {
                    insertsql += ",YearID,YearTo";
                }
                else
                {
                    insertsql += ",YearID=@YearID,YearTo=@YearTo";
                }
                cmd1.Parameters.Add("YearTo", SqlDbType.NVarChar);
                cmd1.Parameters.Add("YearID", SqlDbType.NVarChar);

                cmd1.Parameters["YearID"].Value = yearFrom;
                cmd1.Parameters["YearTo"].Value = yearTo;
            }



            for (int y = 0; y < i; y++)
            {
                RadioButtonList VariablesRadio   = (RadioButtonList)(mydiv.FindControl("VariablesRadio" + y));
                RadioButtonList VariableValuehck = (RadioButtonList)(mydiv.FindControl("VariablesValueChck" + y));
                //if (VariableValuehck.SelectedIndex < 0 || VariablesRadio.SelectedIndex < 0)
                //{
                //    VariableValuehck.SelectedIndex = 0;
                //    VariablesRadio.SelectedIndex = 0;
                //}
                if (VariablesRadio.SelectedIndex >= 0 && VariableValuehck.SelectedIndex >= 0)
                {
                    if (VariableValuehck.SelectedValue.Substring(3) != "00001" &&
                        VariablesRadio.SelectedValue != "unselect")
                    {
                        if (string.IsNullOrEmpty(reportId))
                        {
                            insertsql = insertsql + ",  " + VariablesRadio.SelectedValue.ToString();
                        }
                        else
                        {
                            insertsql = insertsql + ",  " + VariablesRadio.SelectedValue.ToString() + "='" +
                                        VariableValuehck.SelectedValue.ToString() + "'";
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(reportId))
            {
                insertsql = insertsql +
                            " ) values (@ReportEnName,@ReportArName, @ReportFrName,@Source,@SourceAr,@SourceFr,@PublishYear, @ThemeID, @RunningVariableID, @ChangingVariableID";
            }
            if (runningVariable == "004" || changingVariable == "004")
            {
                if (string.IsNullOrEmpty(reportId))
                {
                    insertsql += ",@YearID,  @YearTo";
                }
            }
            for (int y = 0; y < i; y++)
            {
                RadioButtonList VariablesRadio   = (RadioButtonList)(mydiv.FindControl("VariablesRadio" + y));
                RadioButtonList VariableValuehck = (RadioButtonList)(mydiv.FindControl("VariablesValueChck" + y));
                if (VariablesRadio.SelectedIndex >= 0 && VariableValuehck.SelectedIndex >= 0)
                {
                    if (VariableValuehck.SelectedValue.Substring(3) != "00001" &&
                        VariablesRadio.SelectedValue != "unselect")
                    {
                        //if (VariableValuehck.SelectedIndex < 0 || VariablesRadio.SelectedIndex < 0)
                        //{
                        //    VariableValuehck.SelectedIndex = 0;
                        //    VariablesRadio.SelectedIndex = 0;
                        //}
                        if (VariablesRadio.SelectedIndex >= 0 && VariableValuehck.SelectedIndex >= 0)
                        {
                            if (string.IsNullOrEmpty(reportId))
                            {
                                insertsql = insertsql + ",'" + VariableValuehck.SelectedValue.ToString() + "'";
                            }
                        }
                    }
                }
            }
            if (string.IsNullOrEmpty(reportId))
            {
                insertsql = insertsql + " )";
            }

            if (!string.IsNullOrEmpty(reportId))
            {
                string column =
                    "YearID, YearTo, GenderID, GovID, MaritalStatusID,EducationLevelID,AgeID, SectorID, CountryID, MonthID, NationailtyID, SchoolTypeID, " +
                    "EconomicActivityID, CostID, GeographicalDistributionID, GovernoratesGroupID, GenderRatioID, EstablishmentID, AgeID3, UniversityID, FacultyID, " +
                    "InistitueID, DropOutID, TeahcingPositionsID, WaterID, WaterProducerID, RoadID, VehicleID, TransportedItemID, CargoStatusTravelingID, TravelStatusID, " +
                    "CommodityID, CommodityGroupID, CaseTypeID, CaseStatusID, AssociationsActivityID, CulturalServiceAssociationsID, SocialServiceAssociationsID, IssuedCapitalID, " +
                    "WaterPollutionIndicatorID, TransportingFacilityID, PortNameID, AirPollutionID, AreaDateID, CropsSeasonID, liveStockID, OriginPlaceID, BorrowingPurposeID, AuthoritySurveillanceID, " +
                    "ServiceID, FisheryRegionID, FoodProductsID, ChemicalProductID, PaperPrintingProductID, RubberPlasticProductID, TextileProductID, MetalicEngineeringElectricProductID, " +
                    "ConstrcutionsMaterialRefractoryProductID, PetroluemNaturalGasProductID, TradeID, CountriesGroupID, ArrivalMethodID, HotelTypeID, RadioStationID, ProgramTypeID, " +
                    "SubjectTypeID, MuseumTypeID, IndustrySectionsID, EducationalTypeID, ExtraVariableID, ExtraVariableValue";
                foreach (string itm in column.Split(new[] { ',' }))
                {
                    if (!insertsql.Contains(itm.Trim()))
                    {
                        insertsql += " , " + itm + " = null ";
                    }
                }
                insertsql += " where ReportID=" + reportId;
            }
            cmd1.Connection  = con;
            cmd1.CommandType = CommandType.Text;
            cmd1.CommandText = insertsql;
            con.Open();
            int result = cmd1.ExecuteNonQuery();

            con.Close();
            return(result);
        }
Esempio n. 14
0
        public List <RespuestaEncuesta> ObtenerCapturaMascara()
        {
            List <RespuestaEncuesta> lstCamposCapturados;

            try
            {
                Encuesta encuesta = (Encuesta)Session["EncuestaActiva"];
                lstCamposCapturados = new List <RespuestaEncuesta>();
                switch (encuesta.IdTipoEncuesta)
                {
                case (int)BusinessVariables.EnumTipoEncuesta.Logica:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 0; i < 2; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);
                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTicket,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i == 0 ? 0 : 1,
                                            Ponderacion    = i == 0 ? 0 : pregunta.Ponderacion
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.Calificacion:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 0; i < 10; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);
                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTicket,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i,
                                            Ponderacion    = ((i + 1) * 10),
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.OpcionMultiple:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 1; i < 6; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);

                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTicket,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i,
                                            Ponderacion    = (pregunta.Ponderacion / 5) * i
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(lstCamposCapturados);
        }
Esempio n. 15
0
        public void ManageToolbarRights(HtmlGenericControl toolbarPane, DataRow drFormRights)
        {
            if (drFormRights != null)
            {
                Button btnNew      = (Button)toolbarPane.FindControl("btnNew");
                Button btnUpdate   = (Button)toolbarPane.FindControl("btnUpdate");
                Button btnDelete   = (Button)toolbarPane.FindControl("btnDelete");
                Button btnNavigate = (Button)toolbarPane.FindControl("btnNavigate");

                if (drFormRights["PMR_INSERTION_FLAG"] != null)
                {
                    if (btnNew != null)
                    {
                        if (drFormRights["PMR_INSERTION_FLAG"] == null || Formatter.SetValidValueToBoolean(drFormRights["PMR_INSERTION_FLAG"]) == false)
                        {
                            btnNew.Enabled = false;
                        }
                        else
                        {
                            if (btnNew.Enabled == false)
                            {
                                btnNew.Enabled = true;
                            }
                        }
                    }
                }
                if (drFormRights["PMR_UPDATION_FLAG"] != null)
                {
                    if (btnUpdate != null)
                    {
                        if (drFormRights["PMR_UPDATION_FLAG"] == null || Formatter.SetValidValueToBoolean(drFormRights["PMR_UPDATION_FLAG"]) == false)
                        {
                            btnUpdate.Enabled = false;
                        }
                        else
                        {
                            if (btnUpdate.Enabled == false)
                            {
                                btnUpdate.Enabled = true;
                            }
                        }
                    }
                }
                if (drFormRights["[PMR_DELETION_FLAG"] != null)
                {
                    if (btnDelete != null)
                    {
                        if (drFormRights["[PMR_DELETION_FLAG"] == null || Formatter.SetValidValueToBoolean(drFormRights["[PMR_DELETION_FLAG"]) == false)
                        {
                            btnDelete.Enabled = false;
                        }
                        else
                        {
                            if (btnDelete.Enabled == false)
                            {
                                btnDelete.Enabled = true;
                            }
                        }
                    }
                }
                if (drFormRights["PMR_SELECTION_FLAG"] != null)
                {
                    if (btnNavigate != null)
                    {
                        if (drFormRights["PMR_SELECTION_FLAG"] == null || Formatter.SetValidValueToBoolean(drFormRights["[PMR_SELECTION_FLAG"]) == false)
                        {
                            btnNavigate.Enabled = false;
                        }
                        else
                        {
                            if (btnNavigate.Enabled == false)
                            {
                                btnNavigate.Enabled = true;
                            }
                        }
                    }
                }
            }
        }
Esempio n. 16
0
        public List <RespuestaEncuesta> ObtenerCapturaMascara()
        {
            List <RespuestaEncuesta> lstCamposCapturados;

            try
            {
                Encuesta encuesta = (Encuesta)Session["EncuestaActiva"];
                lstCamposCapturados = new List <RespuestaEncuesta>();
                switch (encuesta.IdTipoEncuesta)
                {
                case (int)BusinessVariables.EnumTipoEncuesta.PromotorScore:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 0; i <= 10; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);
                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTipoServicio != (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdArbol        = IdTipoServicio == (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i,
                                            Ponderacion    = i * 10,
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.SiNo:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 0; i < 2; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);
                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTipoServicio != (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdArbol        = IdTipoServicio == (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i == 0 ? 0 : 1,
                                            Ponderacion    = i == 0 ? 0 : pregunta.Ponderacion
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.Calificacion:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 0; i <= 10; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);
                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTipoServicio != (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdArbol        = IdTipoServicio == (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i,
                                            Ponderacion    = ((i + 1) * 10),
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;

                case (int)BusinessVariables.EnumTipoEncuesta.CalificacionPesimoMaloRegularBuenoExcelente:
                    foreach (EncuestaPregunta pregunta in encuesta.EncuestaPregunta)
                    {
                        HtmlGenericControl divControl = (HtmlGenericControl)divControles.FindControl("createDiv" + pregunta.Id);
                        if (divControl != null)
                        {
                            HtmlGenericControl divGrupo = (HtmlGenericControl)divControl.FindControl("createDivs" + pregunta.Id);
                            if (divGrupo != null)
                            {
                                for (int i = 1; i < 6; i++)
                                {
                                    RadioButton rbtn = (RadioButton)divGrupo.FindControl("rbtn" + pregunta.Id + i);

                                    if (rbtn.Checked)
                                    {
                                        lstCamposCapturados.Add(new RespuestaEncuesta
                                        {
                                            IdEncuesta     = encuesta.Id,
                                            IdTicket       = IdTipoServicio != (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdArbol        = IdTipoServicio == (int)BusinessVariables.EnumTipoArbol.ConsultarInformacion ? IdTicket : (int?)null,
                                            IdPregunta     = pregunta.Id,
                                            ValorRespuesta = i,
                                            Ponderacion    = (pregunta.Ponderacion / 5) * i
                                        });
                                        break;
                                    }
                                }
                            }
                        }
                    }
                    break;
                }
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return(lstCamposCapturados);
        }