コード例 #1
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (cmstrDefualts.CheckQueryString("sitelang", out myLang))
     {
         if (Request.QueryString["country"] != null && int.TryParse(Request.QueryString["country"], out blogid))
         {
             if (blogid == 0)
             {
                 BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                 ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("NameMyTextBox")).Visible = true;
             }
             else
             {
                 //((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("NameMyTextBox")).Visible = false;
                 BlogTypeMyForm.DataKeyFieldValue = blogid;
             }
             ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("BlogTypeName")).DataFieldName = myLang.ToString();
             BlogTypeMyForm.SaveButtonText = "Save";
             BlogTypeMyForm.DataKeyField   = "idtbllang";
             BlogTypeMyForm.BackButtonText = "Back";
             BlogTypeMyForm.SaveReturnText = "Save&Back";
             BlogTypeMyForm.BackURL        = "ManageLanguages.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
         }
         else
         {
             BlogTypeMyForm.Visible = false;
         }
         CatsTable.SqlFieldNames = String.Format("langname,`{0}`", myLang);
         CatsTable.EditUrl       = "ManageLanguages.aspx?country={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
         CatsTable.AddLink       = "ManageLanguages.aspx?country=0&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
     }
 }
コード例 #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (siteDefaults.CheckQueryString("sitelang", out myLang))
        {
            if (Request.QueryString["country"] != null && int.TryParse(Request.QueryString["country"], out blogid))
            {
                using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
                {
                    string       sql = String.Format("Select CountryNameeng From countries where countryid={0}", blogid);
                    MySqlCommand cmd = new MySqlCommand(sql, conn);
                    conn.Open();
                    MySqlDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        BlogTypeMyForm.Header = string.Format("Country: {0}", dr["CountryNameeng"].ToString());
                    }
                }

                ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("BlogTypeName")).DataFieldName = myLang.ToString();
                BlogTypeMyForm.DataKeyFieldValue = blogid;
                BlogTypeMyForm.SaveButtonText    = "Save";
                BlogTypeMyForm.DataKeyField      = "countryid";
                BlogTypeMyForm.BackButtonText    = "Back";
                BlogTypeMyForm.SaveReturnText    = "Save&Back";
                BlogTypeMyForm.BackURL           = "ManageCountries.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
            }
            else
            {
                BlogTypeMyForm.Visible = false;
            }
            CatsTable.SqlFieldNames = String.Format("CountryNameeng,`{0}`", myLang);
            CatsTable.EditUrl       = "ManageCountries.aspx?country={field}&id=" + Request.QueryString["id"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
        }
    }
コード例 #3
0
    protected void UpdateTags_Click(object sender, EventArgs e)
    {
        string myTagsVals = ((tableControl)BlogTypeMyForm.FindControl("TagsTable")).SelectedValsHidVal;

        string[] myTagsValsArray = { };
        myTagsValsArray = myTagsVals.Split(',');

        using (MySqlConnection conn = new MySqlConnection(cmstrDefualts.ConnStr))
        {
            conn.Open();
            string       sql = String.Format("Delete From tbltagsforMissions where missionID={0}", contatctid);
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            cmd.ExecuteNonQuery();
            foreach (string Tag in myTagsValsArray)
            {
                int TagNumber = 0;
                if (int.TryParse(Tag, out TagNumber))
                {
                    cmd.CommandText = String.Format("Insert Into tbltagsforMissions (TagID,MissionID) Values ({0},{1})", Tag, contatctid);
                    cmd.ExecuteNonQuery();
                }
            }
            conn.Close();
        }
    }
コード例 #4
0
    //    int siteLang = 0;
    protected void Page_Load(object sender, EventArgs e)
    {
        //  CatsTable.SqlWhereQuery = String.Format("gamelang={0}", siteLang);

        if (Request.QueryString["contact"] != null && int.TryParse(Request.QueryString["contact"], out contatctid))
        {
            BlogTypeMyForm.BackURL = "ManagePages.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];

            if (contatctid == 0)
            {
                BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("hid_Guid")).Value = Guid.NewGuid().ToString();
                // ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("LangMyHiddenField")).Value = siteLang.ToString();
            }
            else
            {
                using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
                {
                    string       sql = String.Format("Select pagename From tblpages where idtblpages={0}", contatctid);
                    MySqlCommand cmd = new MySqlCommand(sql, conn);
                    conn.Open();
                    MySqlDataReader dr = cmd.ExecuteReader();
                    if (dr.Read())
                    {
                        BlogTypeMyForm.Header = string.Format("עריכת דף: {0}", dr["pagename"].ToString());
                    }
                    dr.Close();
                    sql             = "select tagid from tbltagsforMissions where missionid=" + contatctid;
                    myTagsArray     = new List <string>();
                    cmd.CommandText = sql;
                    dr = cmd.ExecuteReader();
                    while (dr.Read())
                    {
                        myTagsArray.Add(dr["tagid"].ToString());
                    }
                    if (!IsPostBack)
                    {
                        ((tableControl)BlogTypeMyForm.FindControl("TagsTable")).SelectedValsHidVal = String.Join(",", myTagsArray.ToArray());
                    }
                }
                BlogTypeMyForm.FormStatus        = CMSTRFormWebUserControl.Status.Update;
                BlogTypeMyForm.DataKeyFieldValue = contatctid;
            }
        }
        else
        {
            BlogTypeMyForm.Visible = false;
        }

        CatsTable.AddLink     = "ManagePages.aspx?sitelang=" + Request.QueryString["sitelang"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&contact=0";
        CatsTable.EditUrl     = "ManagePages.aspx?sitelang=" + Request.QueryString["sitelang"] + "&contact={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];
        CatsTable.CustomField = ",,,<a target=\"blank \"href=\"" + siteDefaults.SiteUrl + "/Mission.aspx?name={0}" + "\"  ><img alt=\"view\" title=\"View\" src=\"images/preview.png\"  /></a>,<textarea style=\"height:50px;width:400px;text-align:left;\"  onmouseup=\"selectonfocus(this)\" >" + siteDefaults.SiteUrl + "/Mission.aspx?name={0}&mail=[[email]]</textarea>,<a href=\"MissionStats.aspx?MissionID={0}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "\"><img title=\"הצג סטטיסטיקות למשימה\" src=\"images/pie-3d.png\" style=\"width:20px; height:20px;\" /></a>";



        // CatsTable.CustomField = ",,<a href=\"ManageHelpArticle.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&MyParent={0}\" >נהל</a>";
        //   CatsTable.SqlWhereQuery = "helpParent=0";
    }
コード例 #5
0
    protected void btnPost_Click(object sender, EventArgs e) //מתודת שליחת פוסט לקיר של הדף בפייסבוק
    {
        FacebookPagePost _post         = new FacebookPagePost();
        string           _postResponse = "";

        _post.message = ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("txt_PostText")).Text;
        using (MySqlConnection con = new MySqlConnection(siteDefaults.ConnStr))
        {
            con.Open();
            MySqlCommand _cmd = new MySqlCommand();
            _cmd.Connection  = con;
            _cmd.CommandText = "select * from facebookpages where FacebookPagesID = 1";
            MySqlDataReader _dr = _cmd.ExecuteReader();
            if (_dr.Read())
            {
                _post.id           = _dr["PageID"].ToString();
                _post.access_token = _dr["AccessToken"].ToString();
            }
            _dr.Close();
            con.Close();
        }
        _post.link = ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("Post_Link")).Text;

        if (_post.access_token != "" && _post.access_token != null) //בדיקה האם יש טוקן במערכת והאם יש קבוצה שניתן "לפרסם" בה
        {
            _postResponse = FacebookCode.PostOnFacebookPage(_post); //ביצוע פוסט + קבלת מספר פוסט בכתשובה
            if (_postResponse != "")                                //בדיקה האם חזר מספר פוסט כתשובה מפייסבוק
            {
                using (MySqlConnection con = new MySqlConnection(siteDefaults.ConnStr))
                {
                    con.Open();
                    MySqlCommand _cmd = new MySqlCommand();
                    _cmd.Connection  = con;
                    _cmd.CommandText = "UPDATE tblpages set FB_PostID='" + _postResponse + "' where idtblpages =" + contatctid;
                    _cmd.ExecuteNonQuery();
                    con.Close();
                }

                ((Label)BlogTypeMyForm.FindControl("lblStatus")).Text = "פוסט נשלח בהצלחה!";
            }
            else
            {
                ((Label)BlogTypeMyForm.FindControl("lblStatus")).Text = "הייתה בעיה בשליחת הפוסט";
            }
        }
        else
        {
            ((Label)BlogTypeMyForm.FindControl("lblStatus")).Text = "לא בוצע התחברות לדף פייסבוק עדיין, אנא התחבר לדף";
        }

        //((Label)BlogTypeMyForm.FindControl("lblStatus")).Text = "פוסט נשלח בהצלחה - אנא לחץ שמור לשמירת הנתונים!";
        //((Label)BlogTypeMyForm.FindControl("lblStatus")).Text = _postResponse;

        hid_PostID.Value = _postResponse;

        //((Button)BlogTypeMyForm.FindControl("btnSavePost")).Visible = true;
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (siteDefaults.CheckQueryString("sitelang", out myLang))
        {
        }
        string sql = "";

        if (Request.QueryString["id"] != null && int.TryParse(Request.QueryString["id"], out blogid))
        {
            // check if edit article (else category)
            if (Request.QueryString["article"] != null && int.TryParse(Request.QueryString["article"], out articleid))
            {
                CatsTable.Visible = false;
                if (articleid == 0)
                {
                    BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                    sql = String.Format("Select helpheader, 'New Article' as parentheder From tblevents Where idtblhelpcenter={0}", blogid);
                    BlogTypeMyForm.OrderQuery = string.Format(" where helpParent={0}  AND eventLang={1}", blogid, myLang);
                }
                else
                {
                    BlogTypeMyForm.DataKeyFieldValue = articleid;
                    sql = String.Format("Select event1.helpheader, (select helpheader From tblevents where idtblhelpcenter=event1.helpParent) as parentheder From tblevents as event1 Where event1.idtblhelpcenter={0}", articleid);
                }
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("ParentMyHiddenField")).Value = blogid.ToString();
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("LangMyHiddenField")).Value   = myLang.ToString();
                BlogTypeMyForm.BackURL = "EditEventCenterCat.aspx?id=" + Request.QueryString["id"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
            }
            else
            {
                BlogTypeMyForm.DataKeyFieldValue = blogid;
                ((Panel)BlogTypeMyForm.FindControl("ArticleFields")).Visible = false;
                BlogTypeMyForm.BackURL = "ManageEventCenter.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];
                sql = String.Format("Select helpheader, (select helpheader From tblevents where idtblhelpcenter=helpParent) as parentheder From tblevents Where idtblhelpcenter={0}", blogid);
            }
            BlogTypeMyForm.SaveButtonText = "Save";
            BlogTypeMyForm.DataKeyField   = "idtblhelpcenter";
            BlogTypeMyForm.BackButtonText = "Back";
            BlogTypeMyForm.SaveReturnText = "Save&Back";
            using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
            {
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                conn.Open();
                MySqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    TitleLabel.Text = String.Format("Blog:  {1} - {0}", dr["helpheader"], dr["parentheder"]);
                }
                CatsTable.SqlWhereQuery = string.Format("helpParent={0} AND  eventLang={1}", blogid, myLang);
                CatsTable.AddLink       = "EditEventCenterCat.aspx?article=0&id=" + Request.QueryString["id"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
                CatsTable.EditUrl       = "EditEventCenterCat.aspx?article={field}&id=" + Request.QueryString["id"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
            }
        }
    }
コード例 #7
0
 protected void Unnamed_Click(object sender, EventArgs e)
 {
     using (MySqlConnection con = new MySqlConnection(siteDefaults.ConnStr))
     {
         con.Open();
         MySqlCommand _cmd = new MySqlCommand();
         _cmd.Connection  = con;
         _cmd.CommandText = "UPDATE tblpages set FB_PostID='" + hid_PostID.Value + "' where idtblpages =" + contatctid;
         _cmd.ExecuteNonQuery();
         con.Close();
         ((Label)BlogTypeMyForm.FindControl("lblStatus")).Text = "";
         ((Button)sender).Visible = false;
     }
 }
コード例 #8
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LangTableControl.EditUrl = "ManageProgram.aspx?sitelang={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];

        if (siteDefaults.CheckQueryString("sitelang", out siteLang))
        {
            LangTableControl.Visible = false;
            CatsTable.Visible        = true;
            //  CatsTable.SqlWhereQuery = String.Format("gamelang={0}", siteLang);

            if (Request.QueryString["contact"] != null && int.TryParse(Request.QueryString["contact"], out contatctid))
            {
                BlogTypeMyForm.BackURL = "ManageProgram.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];
                ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("SpecialMyTextBox")).DataFieldName = siteLang.ToString();
                ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("CommentMyTextBox")).DataFieldName = "Comment" + siteLang;


                if (contatctid == 0)
                {
                    BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                    // ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("LangMyHiddenField")).Value = siteLang.ToString();
                }
                else
                {
                    BlogTypeMyForm.FormStatus        = CMSTRFormWebUserControl.Status.Update;
                    BlogTypeMyForm.DataKeyFieldValue = contatctid;
                }
            }
            else
            {
                BlogTypeMyForm.Visible = false;
            }
        }
        else
        {
            LangTableControl.Visible = true;
            CatsTable.Visible        = false;
            BlogTypeMyForm.Visible   = false;
        }
        CatsTable.AddLink = "ManageProgram.aspx?sitelang=" + Request.QueryString["sitelang"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&contact=0";
        CatsTable.EditUrl = "ManageProgram.aspx?sitelang=" + Request.QueryString["sitelang"] + "&contact={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];



        // CatsTable.CustomField = ",,<a href=\"ManageHelpArticle.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&MyParent={0}\" >נהל</a>";
        //   CatsTable.SqlWhereQuery = "helpParent=0";
    }
コード例 #9
0
ファイル: EditBadges.aspx.cs プロジェクト: gadcomstar/Cellcom
    protected void BlogTypeMyForm_ItemInserted(string NewUserID)
    {
        string myVals = ((tableControl)BlogTypeMyForm.FindControl("MissionTable")).SelectedValsHidVal;

        string[] myValsArray = myVals.Split(',');

        string myBadgesVals = ((tableControl)BlogTypeMyForm.FindControl("BadgeTable")).SelectedValsHidVal;

        string[] myBadgesValsArray = { };
        myBadgesValsArray = myBadgesVals.Split(',');



        using (MySqlConnection conn = new MySqlConnection(cmstrDefualts.ConnStr))
        {
            conn.Open();
            string       sql = String.Format("Delete From tblbadgemissions where badgeid={0}", NewUserID);
            MySqlCommand cmd = new MySqlCommand(sql, conn);
            cmd.ExecuteNonQuery();
            foreach (string mission in myValsArray)
            {
                int missionNumber = 0;
                if (int.TryParse(mission, out missionNumber))
                {
                    cmd.CommandText = String.Format("Insert Into tblbadgemissions (badgeid,missionid) Values ({0},{1})", NewUserID, mission);
                    cmd.ExecuteNonQuery();
                }
            }



            sql = String.Format("Delete From tblcronicalbadges where badgeid={0}", NewUserID);
            cmd = new MySqlCommand(sql, conn);
            cmd.ExecuteNonQuery();
            foreach (string badge in myBadgesValsArray)
            {
                int TagNumber = 0;
                if (int.TryParse(badge, out TagNumber))
                {
                    cmd.CommandText = String.Format("Insert Into tblcronicalbadges (badgeid,NeedBadgeID) Values ({0},{1})", NewUserID, badge);
                    cmd.ExecuteNonQuery();
                }
            }
        }
        Badge.ClearList();
    }
コード例 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int mytpo = 1;

        if (cmstrDefualts.CheckQueryString("sitelang", out siteLang))
        {
            //  CatsTable.SqlWhereQuery = String.Format("gamelang={0}", siteLang);
            using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
            {
                string       sql = String.Format("Select toplinemsgid From toplinemsg where toplang={0}", siteLang);
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                conn.Open();
                MySqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    int.TryParse(dr["toplinemsgid"].ToString(), out mytpo);
                }
                else
                {
                    mytpo = 0;;
                }
                dr.Close();
            }
            if (mytpo != 0)
            {
                BlogTypeMyForm.FormStatus        = CMSTRFormWebUserControl.Status.Update;
                BlogTypeMyForm.DataKeyFieldValue = mytpo;
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("LangMyHiddenField")).Visible = false;
            }
            else
            {
                BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("LangMyHiddenField")).Value = siteLang.ToString();
                string muguid = Guid.NewGuid().ToString();
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("MyHiddenField1")).Value = muguid;
                string muguid2 = Guid.NewGuid().ToString();
                ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("MyHiddenField2")).Value = muguid2;
            }
        }
    }
コード例 #11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        LangTableControl.EditUrl = "ManageUserFields.aspx?sitelang={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];

        if (cmstrDefualts.CheckQueryString("sitelang", out siteLang))
        {
            LangTableControl.Visible = false;
            CatsTable.Visible        = true;
            ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("ValueMyTextBox")).DataFieldName = siteLang.ToString();


            CatsTable.SqlFieldNames = String.Format("fieldname,`{0}`", siteLang);
            CatsTable.AddLink       = "ManageUserFields.aspx?sitelang=" + Request.QueryString["sitelang"] + "&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&contact=0";
            CatsTable.EditUrl       = "ManageUserFields.aspx?sitelang=" + Request.QueryString["sitelang"] + "&contact={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];

            if (Request.QueryString["contact"] != null && int.TryParse(Request.QueryString["contact"], out contatctid))
            {
                BlogTypeMyForm.BackURL = "ManageUserFields.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"];
                if (contatctid == 0)
                {
                    BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                }
                else
                {
                    BlogTypeMyForm.FormStatus        = CMSTRFormWebUserControl.Status.Update;
                    BlogTypeMyForm.DataKeyFieldValue = contatctid;
                }
            }
            else
            {
                BlogTypeMyForm.Visible = false;
            }
        }
        else
        {
            LangTableControl.Visible = true;
            CatsTable.Visible        = false;
            BlogTypeMyForm.Visible   = false;
        }
    }
コード例 #12
0
ファイル: EditBadges.aspx.cs プロジェクト: gadcomstar/Cellcom
 protected string BlogTypeMyForm_ItemInserting()
 {
     ((CMSTRHiddenField)BlogTypeMyForm.FindControl("MyDateMyHiddenField")).Value = DateTime.Now.ToString();
     return("insert");
 }
コード例 #13
0
ファイル: EditBadges.aspx.cs プロジェクト: gadcomstar/Cellcom
    protected void Page_Load(object sender, EventArgs e)
    {
        using (MySqlConnection conn = new MySqlConnection(cmstrDefualts.ConnStr))
        {
            conn.Open();
            // Badge.AddBadge(BadgTypeEnum.Join, conn, 29);
        }

        //CMSTRDropDownControl myTagsDropDown = (CMSTRDropDownControl)BlogTypeMyForm.FindControl("BadgeTags");
        CMSTRDropDownControl myTTypeDropDown = (CMSTRDropDownControl)BlogTypeMyForm.FindControl("BagTypeMyDropDown");
        CMSTRDropDownControl myTagsDropDown2 = (CMSTRDropDownControl)BlogTypeMyForm.FindControl("ChooseTagMyDropDown");
        List <Tags>          MyList          = Tags.GetList();

        //myTagsDropDown.ListItems.Add(new ListItem("בחר", "0"));
        myTagsDropDown2.ListItems.Add(new ListItem("בחר", "0"));
        if (MyList.Count > 0)
        {
            for (int i = 0; i < MyList.Count; i++)
            {
                //myTagsDropDown.ListItems.Add(new ListItem(MyList[i].Name, MyList[i].ID.ToString()));
                myTagsDropDown2.ListItems.Add(new ListItem(MyList[i].Name, MyList[i].ID.ToString()));
            }
        }
        List <BadgeType> MyBagTypeList = BadgeType.GetList();

        myTTypeDropDown.ListItems.Add(new ListItem("בחר", "0"));

        if (MyBagTypeList.Count > 0)
        {
            for (int i = 0; i < MyBagTypeList.Count; i++)
            {
                myTTypeDropDown.ListItems.Add(new ListItem(MyBagTypeList[i].Name, MyBagTypeList[i].ID.ToString()));
            }
        }

        if (cmstrDefualts.CheckQueryString("badge", out badgeid))
        {
            if (badgeid == 0)
            {
                BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                //myTagsDropDown.ListItems[0].Selected = true;
                myTTypeDropDown.SelectedValue = "0";
                myTagsDropDown2.SelectedValue = "0";
            }
            else
            {
                if (!IsPostBack)
                {
                    List <Badge> myBadge = Badge.GetBadgeList().Where(x => x.ID == badgeid).ToList();
                    Response.Write(myBadge[0].MissionList.Count);
                    if (myBadge.Count > 0 && myBadge[0].MissionList.Count > 0)
                    {
                        string[] myArray = myBadge[0].MissionList.Select(x => x.ToString()).ToArray();
                        ((tableControl)BlogTypeMyForm.FindControl("MissionTable")).SelectedValsHidVal = String.Join(",", myArray);
                    }
                    if (myBadge.Count > 0 && myBadge[0].AssociatedBadgesList.Count > 0)
                    {
                        string[] myAssociatedBadgesArray = myBadge[0].AssociatedBadgesList.Select(x => x.ToString()).ToArray();
                        ((tableControl)BlogTypeMyForm.FindControl("BadgeTable")).SelectedValsHidVal = String.Join(",", myAssociatedBadgesArray);
                    }
                }
                BlogTypeMyForm.FormStatus        = CMSTRFormWebUserControl.Status.Update;
                BlogTypeMyForm.DataKeyFieldValue = badgeid;
            }
            BlogTypeMyForm.BackURL = "ManageBadges.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"];
        }
    }
コード例 #14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["drop"] != null && int.TryParse(Request.QueryString["drop"], out dropid))
        {
            using (MySqlConnection conn = new MySqlConnection(siteDefaults.ConnStr))
            {
                string       sql = String.Format("Select * From mysitedropdown Where idmysitedropdown={0}", dropid);
                MySqlCommand cmd = new MySqlCommand(sql, conn);
                conn.Open();
                MySqlDataReader dr = cmd.ExecuteReader();
                if (dr.Read())
                {
                    CatsTable.TableTitle    = "Manage " + dr["dropdownname"];
                    CatsTable.SqlWhereQuery = "listid=" + dropid;
                    ((ASP.controls_cmstrhiddenfield_ascx)BlogTypeMyForm.FindControl("ListMyHiddenField")).Value    = dropid.ToString();
                    ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("NameMyTextBox")).FieldName = dr["dropdownname"] + " General Name";
                    ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("BlogTypeName")).FieldName  = dr["dropdownname"] + " Name";
                }
                else
                {
                    Response.Redirect("./");
                }
                dr.Close();

                //for (int i = 140; i < 220; i++)
                //{
                //    string sql2 = String.Format("Insert Into `mydropdownvalues` (dropfieldValue,showfield,`1`,`3`,listid) Values ('{0}',true,'{0}','{0}',5);", i);
                //    cmd.CommandText = sql2;
                //    cmd.ExecuteNonQuery();

                //}

                conn.Close();
            }
        }
        else
        {
            Response.Redirect("./");
        }

        if (siteDefaults.CheckQueryString("sitelang", out myLang))
        {
            if (Request.QueryString["country"] != null && int.TryParse(Request.QueryString["country"], out blogid))
            {
                if (blogid == 0)
                {
                    BlogTypeMyForm.FormStatus = CMSTRFormWebUserControl.Status.Insert;
                    ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("NameMyTextBox")).Visible = true;
                }
                else
                {
                    ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("NameMyTextBox")).Visible = false;
                    BlogTypeMyForm.DataKeyFieldValue = blogid;
                }
                ((ASP.controls_cmstrtextboxcontrol_ascx)BlogTypeMyForm.FindControl("BlogTypeName")).DataFieldName = myLang.ToString();
                BlogTypeMyForm.SaveButtonText = "Save";
                BlogTypeMyForm.DataKeyField   = "idmydropdownvalues";
                BlogTypeMyForm.BackButtonText = "Back";
                BlogTypeMyForm.SaveReturnText = "Save&Back";
                BlogTypeMyForm.BackURL        = "ManageDropDown.aspx?cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"] + "&drop=" + Request.QueryString["drop"];
            }
            else
            {
                BlogTypeMyForm.Visible = false;
            }
            // CatsTable.SqlFieldNames = String.Format("`{0}`", myLang);
            CatsTable.EditUrl       = "ManageDropDown.aspx?country={field}&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"] + "&drop=" + Request.QueryString["drop"];
            CatsTable.AddLink       = "ManageDropDown.aspx?country=0&cat=" + Request.QueryString["cat"] + "&sub=" + Request.QueryString["sub"] + "&sitelang=" + Request.QueryString["sitelang"] + "&drop=" + Request.QueryString["drop"];
            CatsTable.SqlFieldNames = "dropfieldValue,`" + myLang.ToString() + "`";
            CatsTable.SortBy        = "`" + myLang.ToString() + "`";
        }
    }