コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int.TryParse("" + Request.QueryString["UserId"], out UserIdQuery);



        if (UserIdQuery > 0)
        {
            if (DataMapping.Sub_Active(UserIdQuery, "PagePro") == true) //La page est accessible par superuser, par le membre propriétaire même si l'abonnement est inactif
            {
                member = DataMapping.GetMemberByUserID(UserIdQuery);

                if (member != null && member.id != null && member.id > 0 && member.nim > 0)
                {
                    affectation = DataMapping.GetAffectation(member.nim, DateTime.Now.Year);
                    content     = DataMapping.GetContentPagePro(UserIdQuery);

                    Binding_Panel2();
                }
                else
                {
                    //if (PortalSettings.HomeTabId > 0)
                    //{
                    //    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    //}
                    //else
                    //{
                    //    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    //}
                }
            }
            else
            {
                //if (PortalSettings.HomeTabId > 0)
                //{
                //    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                //}
                //else
                //{
                //    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                //}
            }
        }
        else
        {
            //if (PortalSettings.HomeTabId > 0)
            //{
            //    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
            //}
            //else
            //{
            //    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
            //}
        }
    }
コード例 #2
0
    protected void GVW_Annonces_ItemDataBound(object sender, ListViewItemEventArgs e)
    {
        try
        {
            if (e.Item == null)
            {
                return;
            }

            if (e.Item.ItemType == ListViewItemType.DataItem)
            {
                AIS.Content c = ((AIS.Content)e.Item.DataItem);

                //System.Web.UI.HtmlControls.HtmlGenericControl lbl = (System.Web.UI.HtmlControls.HtmlGenericControl)e.Item.FindControl("LBL_Titre");
                Label l = (Label)e.Item.FindControl("Label1");
                l.Text = c.title;

                //Hyperlink1
                //Label1
                //Literal1

                Literal lbl1    = (Literal)e.Item.FindControl("Literal1");
                string  letexte = StripHTML(c.text);
                if (letexte.Length > 20)
                {
                    lbl1.Text = letexte.Substring(0, 20) + " ...";
                }
                else
                {
                    lbl1.Text = letexte;
                }

                HyperLink hl = (HyperLink)e.Item.FindControl("Hyperlink1");
                hl.NavigateUrl = Functions.UrlAddParam(Globals.NavigateURL(Annoncetabid), "id_contenu", "" + c.id);
                //hl.Text = "Voir l'annonce";
                hl.ToolTip = "Voir l'annonce";
            }
        }
        catch (Exception ee)
        {
            Functions.Error(ee);
        }
    }
コード例 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        int.TryParse("" + Request.QueryString["id_content"], out id_content);

        if (id_content > 0)
        {
            content = DataMapping.GetContent_by_ID(id_content);

            if (content != null && content.id > 0)
            {
                Session["type"] = content.type;
                //if (contenu.type == "Annonce" && contenu.id_user == UserInfo.UserID)
                //{
                //    Panel2.Visible = true;
                //    Panel1.Visible = false;

                //    Binding_Panel2();
                //}
                //else if (contenu.type == "PagePro" && contenu.id_user == UserInfo.UserID)
                //{
                //    Panel2.Visible = false;
                //    Panel1.Visible = true;

                //    membre = DataMapping.GetMemberByUserID(contenu.id_user);

                //     if (membre != null && membre.id != null && membre.id > 0 && membre.nim > 0)
                //     {
                //         affectation = DataMapping.GetAffectation(membre.nim, DateTime.Now.Year);

                //         Binding_Panel1();
                //     }
                //}

                if (DataMapping.Sub_Active_by_id_content(content.id, content.type) == false && content.id_user == UserInfo.UserID)
                {
                    Panel3.Visible = true;


                    if (content.type == "Annonce")
                    {
                        item_name  = "Paiement pour l'annonce " + content.title;
                        item_value = content.id.ToString();
                        amount     = Const.Price_Announcement;
                    }
                    else if (content.type == "PagePro")
                    {
                        member = DataMapping.GetMemberByUserID(content.id_user);
                        string nameMember = "";
                        if (member != null)
                        {
                            if (!string.IsNullOrEmpty(member.surname))
                            {
                                nameMember += member.surname;
                            }

                            if (!string.IsNullOrEmpty(member.name))
                            {
                                nameMember += " " + member.name;
                            }
                        }

                        item_name  = "Paiement pour la présentation de " + nameMember.Trim();
                        item_value = content.id.ToString();
                        amount     = Const.Price_Presentation;
                    }

                    string url = Globals.NavigateURL(abonnementtabid);
                    //data-notify_url=\"http://www.rotary1730.org/EspaceProfessionnel/RetourPaypal.aspx\"
                    //A commenter pour passer en PROD
                    //LTL_Paypal.Text = "<script  src=\"https://www.paypalobjects.com/js/external/[email protected]\" data-tax=\"0\" data-shipping=\"0\" data-currency=\"EUR\" data-amount=\"" + amount + "\" data-quantity=\"1\" data-name=\"" + item_name + "\" data-number=\"" + item_value + "\" data-lc=\"fr_FR\" data-button=\"donate\" data-env=\"sandbox\"  data-return=" + url + " data-cancel=\"http://www.rotary1730.org\" ></script>";

                    //A decommenter pour passer en PROD
                    LTL_Paypal.Text = "<script  src=\"https://www.paypalobjects.com/js/external/[email protected]\" data-tax=\"0\" data-shipping=\"0\" data-currency=\"EUR\" data-amount=\"" + amount + "\" data-quantity=\"1\" data-name=\"" + item_name + "\" data-number=\"" + item_value + "\" data-lc=\"fr_FR\" data-button=\"donate\"  data-return=" + url + " data-cancel=\"http://www.rotary1730.org\" ></script>";
                }
                else
                {
                    Panel3.Visible = false;
                }

                if (UserInfo.IsSuperUser)
                {
                    //Panel2.Visible = true;
                    //Panel1.Visible = true;
                    Panel3.Visible = true;

                    //Binding_Panel2();
                    //Binding_Panel1();
                }
            }
            else if (UserInfo.IsSuperUser)
            {
                //Panel2.Visible = true;
                //Panel1.Visible = true;
                Panel3.Visible = true;
            }
            else
            {
                if (PortalSettings.HomeTabId > 0)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                }
                else
                {
                    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                }
            }
        }
        else if (UserInfo.IsSuperUser)
        {
            //Panel2.Visible = true;
            //Panel1.Visible = true;
            Panel3.Visible = true;
        }
        else
        {
            if (PortalSettings.HomeTabId > 0)
            {
                Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
            }
            else
            {
                Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
            }
        }
    }
コード例 #4
0
    protected void BT_Valider_Click(object sender, EventArgs e)
    {
        int i    = 0;
        int id_c = 0;

        try
        {
            AIS.Content c          = new AIS.Content();
            string      id_contenu = "" + Session["id_contenu"];
            if (!string.IsNullOrEmpty(id_contenu))
            {
                int.TryParse(id_contenu, out i);
                if (i > 0)
                {
                    c.id = i;
                }
            }

            c.published = "" + Session["publie"];
            c.id_user   = UserInfo.UserID;
            c.photo     = HF_Logo.Value;
            c.text      = TXT_Editor.Content;
            c.title     = TBX_Titre.Text.Trim();
            c.type      = "Annonce";
            c.textFile  = TXT_Url_Texte.Text.Trim();

            if (RBT_Demande.Checked == true)
            {
                c.announcementType = "demande";
            }
            else
            {
                c.announcementType = "offre";
            }

            Session["id_contenu"] = null;

            id_c = DataMapping.Insert_Content(c);

            Session["Insert"] = null;
            Session["publie"] = null;

            if (id_c > 0)
            {
                if (Session[HF_Logo.Value] != null)
                {
                    string        chemin = PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + id_c + "/" + HF_Logo.Value;
                    DirectoryInfo d      = new DirectoryInfo(Server.MapPath(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + id_c + "/"));
                    if (!d.Exists)
                    {
                        d.Create();
                    }
                    File.WriteAllBytes(Server.MapPath(chemin), ((Media)Session[HF_Logo.Value]).content);

                    Session[HF_Logo.Value] = null;
                }

                if (Session[HL_Url.Text] != null)
                {
                    string        chemin = PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + id_c + "/" + HL_Url.Text;
                    DirectoryInfo d      = new DirectoryInfo(Server.MapPath(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + id_c + "/"));
                    if (!d.Exists)
                    {
                        d.Create();
                    }
                    File.WriteAllBytes(Server.MapPath(chemin), ((Media)Session[HL_Url.Text]).content);

                    Session[HL_Url.Text] = null;
                }
            }
            else
            {
                throw new Exception("");
            }
        }
        catch (Exception ee)
        {
            Functions.Error(ee);
            //retour à l'annonce
            Response.Redirect(Functions.UrlAddParam(Globals.NavigateURL(Annoncetabid), "id_contenu", "" + i));
        }

        if (id_c > 0)
        {
            if (DataMapping.Sub_Active_by_id_content(id_c, "Annonce") == true || UserInfo.IsSuperUser)
            {
                //retour à l'annonce
                Response.Redirect(Functions.UrlAddParam(Globals.NavigateURL(Annoncetabid), "id_contenu", "" + id_c));
            }
            else
            {
                string s = Functions.UrlAddParam(Globals.NavigateURL(Dontabid), "id_contenu", "" + id_c);
                Response.Redirect(s);
            }
        }
    }
コード例 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //Post back to either sandbox or live
        //string strSandbox = "https://www.sandbox.paypal.com/cgi-bin/webscr";
        string strLive = "https://www.paypal.com/cgi-bin/webscr";

        //Pour la prod, passer HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strLive); en decommenté et l'autre en commenter
        //HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strSandbox);
        HttpWebRequest req = (HttpWebRequest)WebRequest.Create(strLive);

        //Set values for the request back
        req.Method      = "POST";
        req.ContentType = "application/x-www-form-urlencoded";
        byte[] param            = Request.BinaryRead(HttpContext.Current.Request.ContentLength);
        string strRequest       = Encoding.ASCII.GetString(param);
        string strResponse_copy = strRequest;  //Save a copy of the initial info sent by PayPal

        strRequest       += "&cmd=_notify-validate";
        req.ContentLength = strRequest.Length;


        //for proxy
        //WebProxy proxy = new WebProxy(new Uri("http://url:port#"));
        //req.Proxy = proxy;
        //Send the request to PayPal and get the response
        StreamWriter streamOut = new StreamWriter(req.GetRequestStream(), System.Text.Encoding.ASCII);

        streamOut.Write(strRequest);
        streamOut.Close();
        StreamReader streamIn    = new StreamReader(req.GetResponse().GetResponseStream());
        string       strResponse = streamIn.ReadToEnd();

        streamIn.Close();


        if (strResponse.ToLower() == "verified")
        {
            //check the payment_status is Completed
            //check that txn_id has not been previously processed
            //check that receiver_email is your Primary PayPal email
            //check that payment_amount/payment_currency are correct
            //process payment

            // pull the values passed on the initial message from PayPal

            NameValueCollection these_argies = HttpUtility.ParseQueryString(strResponse_copy);
            string user_email       = "" + these_argies["payer_email"];
            string pay_stat         = "" + these_argies["payment_status"];
            string Item_name        = "" + these_argies["item_name"];
            string Item_number      = "" + these_argies["item_number"];
            string Payment_amount   = "" + these_argies["mc_gross"];
            string Payment_currency = "" + these_argies["mc_currency"];
            string Txn_id           = "" + these_argies["txn_id"];
            Txn_id = Txn_id.Trim();
            string Receiver_email = "" + these_argies["receiver_email"];


            if (pay_stat.ToLower().Equals("completed"))
            {
                if (!string.IsNullOrEmpty(Item_number) && !string.IsNullOrEmpty(Txn_id))
                {
                    int id_contenu = 0;
                    int.TryParse(Item_number, out id_contenu);

                    double montant = 0;
                    double.TryParse(Payment_amount, System.Globalization.NumberStyles.Number, CultureInfo.InvariantCulture, out montant);

                    if (id_contenu > 0 && !string.IsNullOrEmpty(Txn_id) && montant > 0)
                    {
                        AIS.Content c = DataMapping.GetContent_by_ID(id_contenu);
                        if (c != null)
                        {
                            DateTime fin = DateTime.Now;
                            if (c.type == "PagePro")
                            {
                                fin = fin.AddMonths(Const.Duration_Presentation);
                            }
                            else if (c.type == "Annonce")
                            {
                                fin = fin.AddMonths(Const.Duration_Announcement);
                            }

                            bool?test = DataMapping.IdOrder_Exist(Txn_id);
                            if (test != null && test == false)
                            {
                                if (DataMapping.Insert_Subscription(c.id_user, Txn_id, c.id, c.type, DateTime.Now, fin, "o", montant) == true)
                                {
                                    if (DataMapping.Update_Publish("o", c.id) == true)
                                    {
                                        Member m = DataMapping.GetMemberByUserID(c.id_user);

                                        string message = "Un paiement a été effectué.<br/>";
                                        if (c.type == "Annonce")
                                        {
                                            message += "Il concerne l'annonce: <a href=\"" + Functions.UrlAddParam(Globals.NavigateURL(annoncetabid), "id_contenu", "" + c.id) + "\">" + c.title + "</a> <br/>";
                                        }
                                        else
                                        {
                                            message += "Il concerne la présentation du membre: <a href=\"" + Functions.UrlAddParam(Globals.NavigateURL(presentationtabid), "UserId", "" + c.id_user) + "\">" + m.surname + " " + m.name + "</a> <br/>";
                                        }



                                        PortalSettings ps = Globals.GetPortalSettings();

                                        Functions.SendMail(ps.Email, "Paiement effectué", message);
                                    }
                                    else
                                    {
                                        Exception ee = new Exception("Erreur après paiement lors de la mise à publication du contenu : " + c.id);
                                        Functions.Error(ee);
                                    }
                                }
                                else
                                {
                                    Exception ee = new Exception("Erreur lors de l'insert de l'abonnement pour le contenu : " + c.id + " pour la commande : " + Txn_id);
                                    Functions.Error(ee);
                                }
                            }
                            else if (test != null && test == true)
                            {
                                //Exception ee = new Exception("La transaction: " + id_commande + " existe!");
                                //Functions.Error(ee);
                            }
                            else if (test == null)
                            {
                                Exception ee = new Exception("Impossible de vérifier si la transaction: " + Txn_id + " existe!");
                                Functions.Error(ee);
                            }
                        }
                        else
                        {
                            Exception ee = new Exception("Content: " + id_contenu + " non récupéré!");
                            Functions.Error(ee);
                        }
                    }
                    else
                    {
                        Exception ee = new Exception("PB Conversion de " + Item_number + " en  id_contenu = " + id_contenu + " et/ou  de " + Payment_amount + " en montant = " + montant + " et/ou le numéro de commande est vide ou null ");
                        Functions.Error(ee);
                    }
                }
                else
                {
                    Exception ee = new Exception("Le retour paiement : Item_number et/ou Txn_id vide ou null.");
                    Functions.Error(ee);
                }
            }
            else
            {
                Exception ee = new Exception("Le retour paiement du contenu : " + Item_number + " ayant l'id transaction paypal : " + Txn_id + " n'est pas completed. Il est a l'état : " + pay_stat);
                Functions.Error(ee);
            }
        }
        else if (strResponse.ToLower() == "invalid")
        {
            Exception ee = new Exception("Le retour paiement est revenu Invalid");
            Functions.Error(ee);
        }
        else
        {
            Exception ee = new Exception("Le retour paiement n'est pas revenu Invalid ou Verified");
            Functions.Error(ee);
        }
    }
コード例 #6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserInfo.IsInRole(Const.ROLE_MEMBERS) || UserInfo.IsSuperUser)
        {
            int.TryParse("" + Request.QueryString["id_contenu"], out id_contenu);
            if (id_contenu > 0)
            {
                contenu = DataMapping.GetContent_by_ID(id_contenu);
                if (contenu != null)
                {
                    if ((contenu.id > 0 && UserInfo.UserID == contenu.id_user) || UserInfo.IsSuperUser)// seul le super user et le propriétaire de la page peut accéder à cette page de modif
                    {
                        DirectoryInfo d = new DirectoryInfo(Server.MapPath(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/"));
                        if (!d.Exists)
                        {
                            d.Create();
                        }
                        TXT_Editor.ImageManager.UploadPaths    = new string[] { PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/" };
                        TXT_Editor.DocumentManager.UploadPaths = new string[] { PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/" };

                        if (IsPostBack == false)
                        {
                            Binding_Panel1();
                        } //if (IsPostBack == false)
                    }     //if (UserIdQuery > 0 && UserInfo.UserID == UserIdQuery) || UserInfo.IsSuperUser)
                    else
                    {
                        if (PortalSettings.HomeTabId > 0)
                        {
                            Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                        }
                        else
                        {
                            Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                        }
                    }
                }//if (contenu != null && contenu.id > 0)
                else
                {
                    if (PortalSettings.HomeTabId > 0)
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    }
                    else
                    {
                        Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    }
                }
            }//if (id_contenu > 0)
            else if (UserInfo.IsSuperUser || UserInfo.IsInRole(Const.ROLE_MEMBERS))
            {
                if (IsPostBack == false && !UserInfo.IsSuperUser)
                {
                    Session["Insert"] = "o";
                    Binding_Panel2();
                }//if (IsPostBack == false)
                else if (UserInfo.IsSuperUser)
                {
                    Binding_Panel1();
                }
            }
            else
            {
                if (PortalSettings.HomeTabId > 0)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                }
                else
                {
                    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                }
            }
        }//if (UserInfo.IsInRole(Const.ROLE_MEMBRES) || UserInfo.IsSuperUser)
        else
        {
            if (PortalSettings.HomeTabId > 0)
            {
                Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
            }
            else
            {
                Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
            }
        }
    }
コード例 #7
0
    protected void Binding_Panel2()
    {
        contenu           = new AIS.Content();
        contenu.published = "n";
        contenu.id_user   = UserInfo.UserID;
        contenu.photo     = "";
        contenu.text      = "";
        contenu.title     = "Nouvelle annonce";
        contenu.type      = "Annonce";
        contenu.textFile  = "";


        int id_c = DataMapping.Insert_Content(contenu);

        if (id_c > 0)
        {
            contenu.id = id_c;

            if (contenu != null)
            {
                // Custum image manager
                string        filename_Img = Functions.ClearFileName(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/");
                DirectoryInfo d            = new DirectoryInfo(Server.MapPath(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/"));
                if (!d.Exists)
                {
                    d.Create();
                }
                TXT_Editor.ImageManager.ViewPaths   = new string[] { filename_Img };
                TXT_Editor.ImageManager.UploadPaths = new string[] { filename_Img };
                TXT_Editor.ImageManager.DeletePaths = new string[] { filename_Img };

                // Custum document manager
                string filename_Doc = Functions.ClearFileName(PortalSettings.Current.HomeDirectory + Const.CONTENT_ANNOUNCEMENT_PREFIX + contenu.id + "/");
                TXT_Editor.DocumentManager.ViewPaths   = new string[] { filename_Doc };
                TXT_Editor.DocumentManager.UploadPaths = new string[] { filename_Doc };
                TXT_Editor.DocumentManager.DeletePaths = new string[] { filename_Doc };
                //size
                TXT_Editor.DocumentManager.MaxUploadFileSize = 4194304;
                TXT_Editor.ImageManager.MaxUploadFileSize    = 1048576;

                Session["id_contenu"] = contenu.id;

                Session["publie"] = contenu.published;

                if (!string.IsNullOrEmpty(contenu.text))
                {
                    TXT_Editor.Content = contenu.text;
                }

                if (!string.IsNullOrEmpty(contenu.title))
                {
                    TBX_Titre.Text = contenu.title;
                }

                if (!string.IsNullOrEmpty(contenu.announcementType))
                {
                    if (contenu.announcementType.ToLower() == "offre")
                    {
                        RBT_Offre.Checked = true;
                    }
                    else
                    {
                        RBT_Demande.Checked = true;
                    }
                }

                IMG_Logo.ImageUrl       = contenu.GetAnnoncePhoto();
                HF_Logo.Value           = contenu.photo;
                BT_Effacer_Logo.Visible = contenu.photo != "";

                if (!string.IsNullOrEmpty(contenu.file))
                {
                    HL_Url.NavigateUrl = contenu.GetAnnonceFichier();
                }

                if (!string.IsNullOrEmpty(contenu.textFile))
                {
                    HL_Url.Text        = contenu.textFile;
                    TXT_Url_Texte.Text = contenu.textFile;
                }
            }
        }
        else
        {
        }
    }
コード例 #8
0
ファイル: Annonce.ascx.cs プロジェクト: maelAIS/RODI
    protected void Page_Load(object sender, EventArgs e)
    {
        int.TryParse("" + Request.QueryString["id_content"], out id_content);

        if (id_content > 0)
        {
            content = DataMapping.GetContent_by_ID(id_content);

            if (content.id_user == UserInfo.UserID)
            {
                BTN_Edit.Visible = true;
            }
            else if (UserInfo.IsSuperUser)
            {
                BTN_Edit.Visible = true;
            }
            else
            {
                BTN_Edit.Visible = false;
            }

            if (DataMapping.Sub_Active_by_id_content(id_content, "Annonce") == true || UserInfo.IsSuperUser || UserInfo.UserID == content.id_user) //La page est accessible par superuser, par le membre propriétaire même si l'abonnement est inactif
            {
                Binding_Panel2();
            }
            else
            {
                if (PortalSettings.HomeTabId > 0)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                }
                else
                {
                    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                }
            }
        }
        else if (UserInfo.IsSuperUser)
        {
            BTN_Edit.Visible = true;
            Binding_Panel2();
        }
        else
        {
            List <AIS.Content> contenus = DataMapping.GetListContentHOMEPAGE("Annonce", 1);
            if (contenus != null && contenus.Count() > 0)
            {
                content    = contenus[0];
                id_content = contenus[0].id;
                if (content.id_user == UserInfo.UserID)
                {
                    BTN_Edit.Visible = true;
                }
                else if (UserInfo.IsSuperUser)
                {
                    BTN_Edit.Visible = true;
                }
                else
                {
                    BTN_Edit.Visible = false;
                }

                Binding_Panel2();
            }
            else
            {
                if (PortalSettings.HomeTabId > 0)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                }
                else
                {
                    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                }
            }
        }
    }
コード例 #9
0
    protected void BT_Valider_Click(object sender, EventArgs e)
    {
        int id_c = 0;

        try
        {
            AIS.Content c          = new AIS.Content();
            string      id_contenu = "" + Session["id_contenu"];
            if (!string.IsNullOrEmpty(id_contenu))
            {
                int i = 0;
                int.TryParse(id_contenu, out i);
                if (i > 0)
                {
                    c.id = i;
                }
            }

            c.id_user = UserInfo.UserID;
            c.photo   = HF_Logo.Value;
            c.text    = TXT_Editor.Content;
            c.title   = TBX_Titre.Text.Trim();
            c.company = TBX_Societe.Text.Trim();
            c.type    = "PagePro";
            c.url     = TBX_URL.Text.Trim();

            string pub = "" + Session["publie"];
            if (pub.ToLower() == "o")
            {
                c.published = "o";
            }
            else
            {
                c.published = "n";
            }


            Session["publie"]     = null;
            Session["id_contenu"] = null;

            id_c = DataMapping.Insert_Content(c);

            if (id_c > 0)
            {
                if (Session[HF_Logo.Value] != null)
                {
                    string        chemin = PortalSettings.Current.HomeDirectory + Const.CONTENT_PRESENTATION_PREFIX + id_c + "/" + HF_Logo.Value;
                    DirectoryInfo d      = new DirectoryInfo(Server.MapPath(PortalSettings.Current.HomeDirectory + Const.CONTENT_PRESENTATION_PREFIX + id_c + "/"));
                    if (!d.Exists)
                    {
                        d.Create();
                    }
                    File.WriteAllBytes(Server.MapPath(chemin), ((Media)Session[HF_Logo.Value]).content);

                    Session[HF_Logo.Value] = null;
                }
            }
            else
            {
                throw new Exception("");
            }
        }
        catch (Exception ee)
        {
            Functions.Error(ee);
            //retour à pagemembre
            Response.Redirect(Functions.UrlAddParam(Globals.NavigateURL(Presentationtabid), "UserId", "" + UserInfo.UserID));
        }

        if (id_c > 0)
        {
            if (DataMapping.Sub_Active(UserIdQuery, "PagePro") == true || UserInfo.IsSuperUser)
            {
                //retour à pagemembre
                Response.Redirect(Functions.UrlAddParam(Globals.NavigateURL(Presentationtabid), "UserId", "" + UserInfo.UserID));
            }
            else
            {
                Response.Redirect(Functions.UrlAddParam(Globals.NavigateURL(Dontabid), "id_contenu", "" + id_c));
            }
        }
    }
コード例 #10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (UserInfo.IsInRole(Const.ROLE_MEMBERS) || UserInfo.IsSuperUser)
        {
            int.TryParse("" + Request.QueryString["UserId"], out UserIdQuery);

            if (UserInfo.IsSuperUser && UserIdQuery <= 0)
            {
                UserIdQuery = UserInfo.UserID;
            }

            if ((UserIdQuery > 0 && UserInfo.UserID == UserIdQuery) || UserInfo.IsSuperUser)// seul le super user et le propriétaire de la page peut accéder à cette page de modif
            {
                if (IsPostBack == false)
                {
                    if (UserInfo.IsSuperUser)
                    {
                        Binding_Panel1();
                    }
                    else
                    {
                        membre = DataMapping.GetMemberByUserID(UserIdQuery);

                        if (membre != null && membre.id != null && membre.id > 0 && membre.nim > 0)
                        {
                            affectation = DataMapping.GetAffectation(membre.nim, DateTime.Now.Year);
                            contenu     = DataMapping.GetContentPagePro(UserIdQuery);

                            Binding_Panel1();
                        }
                        else
                        {
                            if (PortalSettings.HomeTabId > 0)
                            {
                                Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                            }
                            else
                            {
                                Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                            }
                        }
                    }
                }
            }
            else //if (UserIdQuery > 0)
            {
                if (!Request.IsAuthenticated)
                {
                    if (PortalSettings.HomeTabId > 0)
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    }
                    else
                    {
                        Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    }
                }
            }
        }
        else
        {
            if (PortalSettings.HomeTabId > 0)
            {
                Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
            }
            else
            {
                Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
            }
        }
    }
コード例 #11
0
    protected void GVW_Annonces_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.DataItem == null)
        {
            return;
        }

        AIS.Content c = ((AIS.Content)e.Row.DataItem);

        //GridView gvOrders = e.Row.FindControl("GVW_Orders") as GridView;
        //FIRST_GVW_Orders_RowDataBound = false;
        //gvOrders.DataSource = DataMapping.GetListAbonnement_by_ID_Content(c.id, "Annonce");
        //gvOrders.DataBind();

        HyperLink hl = (HyperLink)e.Row.FindControl("HLK_Titre");

        hl.NavigateUrl = Functions.UrlAddParam(Globals.NavigateURL(annoncetabid), "id_content", "" + c.id);

        Label lbl = (Label)e.Row.FindControl("LBL_Publie");

        if (c.published.ToLower() == "o")
        {
            lbl.Text = "Oui";
        }
        else
        {
            lbl.Text = "Non";
        }



        List <Subscription> lesa = DataMapping.GetListSubscription_by_ID_Content(c.id, "Annonce");

        if (lesa != null && lesa.Count > 0)
        {
            Subscription a = lesa[0];

            Label lbl_dt_deb = (Label)e.Row.FindControl("LBL_dt_deb");
            lbl_dt_deb.Text = a.dt_beginning.ToString("dd/MM/yyyy");

            Label lbl_dt_fin = (Label)e.Row.FindControl("LBL_dt_fin");
            lbl_dt_fin.Text = a.dt_end.ToString("dd/MM/yyyy");

            Label lbl_actif = (Label)e.Row.FindControl("LBL_Actif");
            if (a.active.ToLower() == "o")
            {
                lbl_actif.Text = "Oui";
            }
            else
            {
                lbl_actif.Text = "Non";
            }

            if (c.published.ToLower() == "n" && a.active.ToLower() == "o")
            {
                Button BTN_pub = (Button)e.Row.FindControl("BTN_publier");
                BTN_pub.Visible         = true;
                BTN_pub.CommandArgument = c.id.ToString();

                Button BTN_DEpub = (Button)e.Row.FindControl("BTN_DE_publier");
                BTN_DEpub.Visible = false;

                Button BTN_Supp = (Button)e.Row.FindControl("BTN_Supp");
                BTN_Supp.Visible = false;
            }
            else if (c.published.ToLower() == "o" && a.active.ToLower() == "o")
            {
                Button BTN_pub = (Button)e.Row.FindControl("BTN_publier");
                BTN_pub.Visible = false;

                Button BTN_DEpub = (Button)e.Row.FindControl("BTN_DE_publier");
                BTN_DEpub.Visible         = true;
                BTN_DEpub.CommandArgument = c.id.ToString();

                Button BTN_Supp = (Button)e.Row.FindControl("BTN_Supp");
                BTN_Supp.Visible = false;
            }
            //else if (a.actif.ToLower() == "n")
            //{
            //    Button BTN_pub = (Button)e.Row.FindControl("BTN_publier");
            //    BTN_pub.Visible = false;

            //    Button BTN_DEpub = (Button)e.Row.FindControl("BTN_DE_publier");
            //    BTN_DEpub.Visible = false;

            //    Button BTN_Supp = (Button)e.Row.FindControl("BTN_Supp");
            //    BTN_Supp.Visible = true;
            //    BTN_Supp.CommandArgument = c.id.ToString();
            //}
            else
            {
                Button BTN_pub = (Button)e.Row.FindControl("BTN_publier");
                BTN_pub.Visible = false;

                Button BTN_DEpub = (Button)e.Row.FindControl("BTN_DE_publier");
                BTN_DEpub.Visible = false;

                Button BTN_Supp = (Button)e.Row.FindControl("BTN_Supp");
                BTN_Supp.Visible = false;
            }
        }
        else
        {
            Label lbl_actif = (Label)e.Row.FindControl("LBL_Actif");
            lbl_actif.Text = "Non";

            Button BTN_pub = (Button)e.Row.FindControl("BTN_publier");
            BTN_pub.Visible = false;

            Button BTN_DEpub = (Button)e.Row.FindControl("BTN_DE_publier");
            BTN_DEpub.Visible = false;

            Button BTN_Supp = (Button)e.Row.FindControl("BTN_Supp");
            BTN_Supp.Visible         = true;
            BTN_Supp.CommandArgument = c.id.ToString();
        }

        if (UserInfo.IsSuperUser)
        {
            Button BTN_pub = (Button)e.Row.FindControl("BTN_publier");
            BTN_pub.Visible = true;

            Button BTN_DEpub = (Button)e.Row.FindControl("BTN_DE_publier");
            BTN_DEpub.Visible = true;

            Button BTN_Supp = (Button)e.Row.FindControl("BTN_Supp");
            BTN_Supp.Visible = true;
        }
    }
コード例 #12
0
ファイル: PageMembre.ascx.cs プロジェクト: maelAIS/RODI
    protected void Page_Load(object sender, EventArgs e)
    {
        int.TryParse("" + Request.QueryString["UserId"], out UserIdQuery);

        if (UserInfo.IsSuperUser && UserIdQuery <= 0)
        {
            UserIdQuery = UserInfo.UserID;
        }

        if (UserIdQuery > 0)
        {
            if (UserIdQuery == UserInfo.UserID)
            {
                BTN_Edit.Visible = true;
            }
            else
            {
                BTN_Edit.Visible = false;
            }

            if (DataMapping.Sub_Active(UserIdQuery, "PagePro") == true || UserInfo.IsSuperUser || UserInfo.UserID == UserIdQuery) //La page est accessible par superuser, par le membre propriétaire même si l'abonnement est inactif
            {
                membre = DataMapping.GetMemberByUserID(UserIdQuery);

                if (membre != null && membre.id != null && membre.id > 0 && membre.nim > 0)
                {
                    affectation = DataMapping.GetAffectation(membre.nim, DateTime.Now.Year);
                    content     = DataMapping.GetContentPagePro(UserIdQuery);

                    Binding_Panel2();
                }
                else if (UserInfo.IsSuperUser)
                {
                    Binding_Panel2();
                }
                else
                {
                    if (PortalSettings.HomeTabId > 0)
                    {
                        Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                    }
                    else
                    {
                        Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                    }
                }
            }
            else
            {
                if (PortalSettings.HomeTabId > 0)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                }
                else
                {
                    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                }
            }
        }
        else
        {
            if (!Request.IsAuthenticated)
            {
                if (PortalSettings.HomeTabId > 0)
                {
                    Response.Redirect(Globals.NavigateURL(PortalSettings.HomeTabId), true);
                }
                else
                {
                    Response.Redirect(Globals.GetPortalDomainName(PortalSettings.PortalAlias.HTTPAlias, Request, true), true);
                }
            }
        }
    }