public void GetAssignRole()
    {
        if (ViewState["intGroupId"] != null)
        {
            objgrp.intRegistrationId = Convert.ToInt32(ViewState["UserID"]);
            objgrp.inGroupId         = Convert.ToInt32(ViewState["intGroupId"]);
            DataSet dschk  = objgrpDB.GetDataSet(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.ViewGrpAssignUser);
            string  Status = string.Empty;

            DataTable dtGrpOpt = objgrpDB.GetDataTable(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.ChkGroupOption);

            if (Convert.ToString(dtGrpOpt.Rows[0]["strAccess"]) == "A")
            {
                GetAccessModuleDetails();

                if (Convert.ToString(dschk.Tables[0].Rows[0][0]) == "0")
                {
                    lnkEdit.Visible = false;
                }
                else
                {
                    lnkEdit.Visible = true;
                }

                if (dschk.Tables[3].Rows.Count > 0)
                {
                    if (Convert.ToString(dschk.Tables[3].Rows[0][0]) == Convert.ToString(ViewState["UserID"]))
                    {
                        divSecondWall.Style.Add("display", "block");
                        DivHome.Style.Add("display", "block");
                        DivForumTab.Style.Add("display", "block");
                        DivUploadTab.Style.Add("display", "block");
                        DivPollTab.Style.Add("display", "block");
                        DivEventTab.Style.Add("display", "block");
                        DivMemberTab.Style.Add("display", "block");
                    }
                }
            }
            else
            {
                if (Convert.ToString(dschk.Tables[0].Rows[0][0]) != "0")
                {
                    divSecondWall.Style.Add("display", "block");
                    DivHome.Style.Add("display", "block");
                    DivForumTab.Style.Add("display", "block");
                    DivUploadTab.Style.Add("display", "block");
                    DivPollTab.Style.Add("display", "block");
                    DivEventTab.Style.Add("display", "block");
                    DivMemberTab.Style.Add("display", "block");
                }
                else
                {
                    lnkEdit.Visible = false;
                    divSecondWall.Style.Add("display", "block");
                    GetAccessModuleDetails();
                }
            }
        }
    }
    protected void GetAccessModuleDetails()
    {
        objgrp.intUserId = Convert.ToInt32(ViewState["UserID"]);
        objgrp.inGroupId = Convert.ToInt32(ViewState["intGroupId"]);
        dt = objgrpDB.GetDataTable(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetGrpModuleDetailsAcces);
        //Profile,Home=Wall,Uploads=Uploads,Events=Events,Discussion=Forum,Polls=Polls,Jobs=Jobs,Members=Members
        if (dt.Rows.Count > 0)
        {
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                string ModuleName = Convert.ToString(dt.Rows[i]["strModuleName"]);

                switch (ModuleName)
                {
                case "Wall": DivHome.Style.Add("display", "block");
                    break;

                case "Uploads": DivUploadTab.Style.Add("display", "block");
                    break;

                case "Events": DivEventTab.Style.Add("display", "block");
                    break;

                case "Discussion": DivForumTab.Style.Add("display", "block");
                    break;

                case "Polls": DivPollTab.Style.Add("display", "block");
                    break;

                case "Members": DivMemberTab.Style.Add("display", "block");
                    break;
                }
            }
        }
    }
    protected void AccessModulePermisssion()
    {
        objDO.intUserId          = Convert.ToInt32(ViewState["UserID"]);
        objDO.inGroupId          = Convert.ToInt32(ViewState["intGroupId"]);
        objgrp.intRegistrationId = Convert.ToInt32(ViewState["UserID"]);
        DataSet   dschk    = objgrpDB.GetDataSet(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.ViewGrpAssignUser);
        DataTable dtRoleAP = objDA.GetDataTable(objDO, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetGrpRoleRequestPermission);

        if (dschk.Tables[3].Rows.Count > 0)
        {
            if (dschk.Tables[3].Rows[0][0].ToString() == Convert.ToString(ViewState["UserID"]))
            {
                divSecondWall.Style.Add("display", "block");
                DivHome.Style.Add("display", "block");
                DivForumTab.Style.Add("display", "block");
                DivUploadTab.Style.Add("display", "block");
                DivPollTab.Style.Add("display", "block");
                DivEventTab.Style.Add("display", "block");
                DivMemberTab.Style.Add("display", "block");
                return;
            }
        }

        if (dtRoleAP.Rows.Count > 0)
        {
            if (dtRoleAP.Rows[0]["IsAccepted"].ToString() != "0" && dtRoleAP.Rows[0]["IsAccepted"].ToString() != "2")
            {
                divSecondWall.Style.Add("display", "block");
                DivHome.Style.Add("display", "block");
                DivForumTab.Style.Add("display", "block");
                DivUploadTab.Style.Add("display", "block");
                DivPollTab.Style.Add("display", "block");
                DivEventTab.Style.Add("display", "block");
                DivMemberTab.Style.Add("display", "block");
                return;
            }
        }
        lnkProfile.Style.Add("width", "25%");
        DivHome.Style.Add("display", "none");
        DivForumTab.Style.Add("display", "none");
        DivUploadTab.Style.Add("display", "none");
        DivPollTab.Style.Add("display", "none");
        DivEventTab.Style.Add("display", "none");
        DivMemberTab.Style.Add("display", "none");
    }
    private void BindScrl_UserGroupDetailTblList(int userid)
    {
        DO_Scrl_UserGroupDetailTbl objDO = new DO_Scrl_UserGroupDetailTbl();
        DA_Scrl_UserGroupDetailTbl objDA = new DA_Scrl_UserGroupDetailTbl();

        objDO.intAddedBy = userid;
        dtlScrl_UserGroupDetailTbl.DataSource = objDA.GetDataTable(objDO, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.AllRecords);
        dtlScrl_UserGroupDetailTbl.DataBind();
    }
Ejemplo n.º 5
0
    protected void AccessModulePermisssion()
    {
        objDOG.intUserId         = Convert.ToInt32(ViewState["UserID"]);
        objDOG.inGroupId         = Convert.ToInt32(ViewState["intGroupId"]);
        objgrp.inGroupId         = Convert.ToInt32(ViewState["intGroupId"]);
        objgrp.intRegistrationId = Convert.ToInt32(ViewState["UserID"]);
        DataSet   dschk    = objgrpDB.GetDataSet(objgrp, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.ViewGrpAssignUser);
        DataTable dtRoleAP = objDAG.GetDataTable(objDOG, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetGrpRoleRequestPermission);

        if (dschk.Tables[3].Rows.Count > 0)
        {
            if (dschk.Tables[3].Rows[0][0].ToString() == ViewState["UserID"].ToString())
            {
                DivHome.Style.Add("display", "block");
                DivForumTab.Style.Add("display", "block");
                DivUploadTab.Style.Add("display", "block");
                DivPollTab.Style.Add("display", "block");
                DivEventTab.Style.Add("display", "block");
                DivMemberTab.Style.Add("display", "block");
                return;
            }
        }

        if (dtRoleAP.Rows.Count > 0)
        {
            if (dtRoleAP.Rows[0]["IsAccepted"].ToString() != "0" && dtRoleAP.Rows[0]["IsAccepted"].ToString() != "2")
            {
                DivHome.Style.Add("display", "block");
                DivForumTab.Style.Add("display", "block");
                DivUploadTab.Style.Add("display", "block");
                DivPollTab.Style.Add("display", "block");
                DivEventTab.Style.Add("display", "block");
                DivMemberTab.Style.Add("display", "block");
            }
            else
            {
                Response.Redirect("Group-Profile.aspx?GrpId=" + ViewState["intGroupId"]);
            }
        }
        else
        {
            Response.Redirect("Group-Profile.aspx?GrpId=" + ViewState["intGroupId"]);
        }
    }
Ejemplo n.º 6
0
 private void BindRole()
 {
     objDO.inGroupId = Convert.ToInt32(Request.QueryString["GrpId"]);
     if (Request.QueryString["AccRegId"] != null)
     {
         dt = objDA.GetDataTable(objDO, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.BindRoleByGrpID);
     }
     else
     {
         dt = objDA.GetOrgDataTable(objDO, DA_Scrl_UserGroupDetailTbl.Scrl_OrgGroupDetailTbl.BindRoleByGrpID);
     }
     if (dt.Rows.Count > 0)
     {
         ddlRoleDetails.DataTextField  = "strRoleName";
         ddlRoleDetails.DataValueField = "intGrpRoleId";
         ddlRoleDetails.DataSource     = dt;
         ddlRoleDetails.DataBind();
         ddlRoleDetails.Items.Insert(0, "Select Role");
     }
     else
     {
         ddlRoleDetails.Items.Insert(0, "Select Role");
     }
 }
    protected void dtlScrl_UserGroupDetailTbl_ItemCommand(object sender, ListViewCommandEventArgs e)
    {
        lblId.Text = "";
        DataTable dtScrl_UserGroupDetailTbl;

        if (e.CommandName == "Edit")
        {
            int index                     = e.Item.DataItemIndex;
            ListViewDataItem item         = (ListViewDataItem)e.Item;
            HiddenField      hdninGroupId = e.Item.FindControl("hdninGroupId") as HiddenField;
            int inGroupId                 = Convert.ToInt32(hdninGroupId.Value);
            PanlShow();
            DO_Scrl_UserGroupDetailTbl objDO = new DO_Scrl_UserGroupDetailTbl();
            DA_Scrl_UserGroupDetailTbl objDA = new DA_Scrl_UserGroupDetailTbl();
            lblId.Text                = Convert.ToString(inGroupId);
            objDO.inGroupId           = inGroupId;
            dtScrl_UserGroupDetailTbl = objDA.GetDataTable(objDO, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.SingleRecord);

            txtGroupName.Text = Convert.ToString(dtScrl_UserGroupDetailTbl.Rows[0]["strGroupName"]);
            txtSummary.Text   = Convert.ToString(dtScrl_UserGroupDetailTbl.Rows[0]["strSummary"]);

            //   drpGroupType.Text=Convert.ToString(dtScrl_UserGroupDetailTbl.Rows[0]["strGroupType"]);
            drpGroupType.ClearSelection();
            BindGroupType();
            try
            {
                drpGroupType.Items.FindByValue(dtScrl_UserGroupDetailTbl.Rows[0]["strGroupType"].ToString()).Selected = true;
            }
            catch
            {
            }

            RdBList_Access.ClearSelection();
            RdBList_Access.Items.FindByValue(dtScrl_UserGroupDetailTbl.Rows[0]["strAccess"].ToString()).Selected = true;

            if (dtScrl_UserGroupDetailTbl.Rows[0]["bitPrivatePublic"].ToString() == "True")
            {
                RdblistPrivPub.ClearSelection();
                RdblistPrivPub.Items.FindByValue("1").Selected = true;
            }
            else if (dtScrl_UserGroupDetailTbl.Rows[0]["bitPrivatePublic"].ToString() == "False")
            {
                RdblistPrivPub.ClearSelection();
                RdblistPrivPub.Items.FindByValue("0").Selected = true;
            }
            else
            {
                RdblistPrivPub.ClearSelection();
            }

            txtDescription.Text = Convert.ToString(dtScrl_UserGroupDetailTbl.Rows[0]["strDescription"]);
            // txtAccess.Text=Convert.ToString(dtScrl_UserGroupDetailTbl.Rows[0]["strAccess"]);

            //  txtLogoPath.Text=Convert.ToString(dtScrl_UserGroupDetailTbl.Rows[0]["strLogoPath"]);
        }
        else if (e.CommandName == "Delete")
        {
            int index                        = e.Item.DataItemIndex;
            ListViewDataItem item            = (ListViewDataItem)e.Item;
            HiddenField      hdninGroupId    = e.Item.FindControl("hdninGroupId") as HiddenField;
            int inGroupId                    = Convert.ToInt32(hdninGroupId.Value);
            DO_Scrl_UserGroupDetailTbl objDO = new DO_Scrl_UserGroupDetailTbl();
            DA_Scrl_UserGroupDetailTbl objDA = new DA_Scrl_UserGroupDetailTbl();
            objDO.inGroupId = inGroupId;

            dtScrl_UserGroupDetailTbl = objDA.GetDataTable(objDO, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.Delete);
            lblMessage.Text           = "Record deleted successfully";
            lblMessage.CssClass       = "GreenErrormsg";

            BindScrl_UserGroupDetailTblList(Convert.ToInt32(ViewState["UserID"]));
        }
    }
Ejemplo n.º 8
0
    private void SendMailGroup()
    {
        try
        {
            SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);

            string mailfrom    = ConfigurationManager.AppSettings["mailfrom"];
            string mailServer  = ConfigurationManager.AppSettings["mailServer"];
            string username    = ConfigurationManager.AppSettings["UserName"];
            string Password    = ConfigurationManager.AppSettings["Password"];
            string Port        = ConfigurationManager.AppSettings["Port"];
            string MailURL     = ConfigurationManager.AppSettings["MailURL"];
            string MailSSL     = ConfigurationManager.AppSettings["MailSSL"];
            string DisplayName = ConfigurationManager.AppSettings["DisplayName"];
            string MailTo      = Convert.ToString(ViewState["TotalMailId"]);
            string Mailbody    = "";

            NetworkCredential cre      = new NetworkCredential(username, Password);
            SmtpClient        clientip = new SmtpClient(mailServer);
            clientip.Port = Convert.ToInt32(Port);
            clientip.UseDefaultCredentials = true;
            if (MailSSL != "0")
            {
                clientip.EnableSsl = true;
            }

            clientip.Credentials = cre;

            try
            {
                MailMessage Rmm2 = new MailMessage();
                Rmm2.IsBodyHtml = true;
                Rmm2.From       = new System.Net.Mail.MailAddress(mailfrom);
                Rmm2.Body       = Mailbody.ToString();
                System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("");

                DataTable dtMailId = new DataTable();
                objDOgroup.strUniqueKey = ViewState["ukey"].ToString();
                dtMailId = objDAgroup.GetDataTable(objDOgroup, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetMailId);
                if (dtMailId.Rows.Count > 0)
                {
                    for (int i = 0; i < dtMailId.Rows.Count; i++)
                    {
                        string name   = Convert.ToString(dtMailId.Rows[i]["Name"]);
                        string MailId = Convert.ToString(dtMailId.Rows[i]["vchrUserName"]);
                        if (MailId != null)
                        {
                            //MailTo += "," + MailId;
                            MailTo   = MailId;
                            htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("<b>Skorkel group joining invitation</b>"
                                                                                                   + "<br><br>" + "Dear " + name + " "
                                                                                                   + "<br><br>" + ViewState["LoginName"]
                                                                                                   + " request you to allow joining " + ViewState["strGroupName"] + " group. <br><br>"
                                                                                                   + "Thanks," + "<br>"
                                                                                                   + "The Skorkel Team<br><br>"
                                                                                                   + "****This is a system generated Email. Kindly do not reply****", null, "text/html");
                            Rmm2.To.Clear();
                            Rmm2.To.Add(MailTo);
                            Rmm2.Subject = "Skorkel Group Joining Request.";
                            Rmm2.AlternateViews.Add(htmlView);
                            Rmm2.IsBodyHtml = true;
                            clientip.Send(Rmm2);
                            Rmm2.To.Clear();
                            // ViewState["TotalMailId"] = TotalMailId;
                        }
                    }
                }
            }
            catch (FormatException ex)
            {
                ex.Message.ToString();
                return;
            }
            catch (SmtpException ex)
            {
                ex.Message.ToString();
                return;
            }
            finally
            {
                conn.Close();
            }
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }
    }
    private void SendMailGroup() //int RecieverID, int SenderID
    {
        try
        {
            string        body     = null;
            DataTable     dtRecord = new DataTable();
            SqlConnection conn     = new SqlConnection(ConfigurationManager.AppSettings["ConnectionString"]);

            string mailfrom    = ConfigurationManager.AppSettings["mailfrom"];
            string mailServer  = ConfigurationManager.AppSettings["mailServer"];
            string username    = ConfigurationManager.AppSettings["UserName"];
            string Password    = ConfigurationManager.AppSettings["Password"];
            string Port        = ConfigurationManager.AppSettings["Port"];
            string MailURL     = ConfigurationManager.AppSettings["MailURL"];
            string MailSSL     = ConfigurationManager.AppSettings["MailSSL"];
            string DisplayName = ConfigurationManager.AppSettings["DisplayName"];
            string MailTo      = Convert.ToString(ViewState["TotalMailId"]);
            string Mailbody    = "";

            objdonetwork.RegistrationId = Convert.ToInt32(ViewState["UserID"]);
            dtRecord = objdanetwork.GetUserConnections(objdonetwork, DA_Networks.NetworkDetails.GetgroupShareInvitee);

            //NetworkCredential cre = new NetworkCredential(username, Password);
            //SmtpClient clientip = new SmtpClient(mailServer);
            //clientip.Port = Convert.ToInt32(Port);
            //clientip.UseDefaultCredentials = true;
            //if (MailSSL != "0")
            //    clientip.EnableSsl = true;

            //clientip.Credentials = cre;

            SmtpClient clientip = new SmtpClient(mailServer);
            clientip.Port = Convert.ToInt32(Port);
            clientip.UseDefaultCredentials = false;
            if (MailSSL != "0")
            {
                clientip.EnableSsl = true;
            }

            clientip.Credentials = new System.Net.NetworkCredential(username, Password);

            try
            {
                MailMessage Rmm2 = new MailMessage();
                Rmm2.IsBodyHtml = true;
                Rmm2.From       = new System.Net.Mail.MailAddress(mailfrom, DisplayName);
                Rmm2.Body       = Mailbody.ToString();
                System.Net.Mail.AlternateView htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("");

                DataTable dtMailId = new DataTable();
                objDOgroup.strUniqueKey = ViewState["ukey"].ToString();
                dtMailId = objDAgroup.GetDataTable(objDOgroup, DA_Scrl_UserGroupDetailTbl.Scrl_UserGroupDetailTbl.GetMailId);
                if (dtMailId.Rows.Count > 0)
                {
                    for (int i = 0; i < dtMailId.Rows.Count; i++)
                    {
                        string name   = Convert.ToString(dtMailId.Rows[i]["Name"]);
                        string MailId = Convert.ToString(dtMailId.Rows[i]["vchrUserName"]);
                        if (MailId != null)
                        {
                            //MailTo += "," + MailId;
                            MailTo = MailId;
                            //htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString("<b>Skorkel group joining invitation</b>"
                            //    + "<br><br>" + "Dear " + name + " "
                            //    + "<br><br>" + ViewState["LoginName"]
                            //    + " request you to allow joining " + ViewState["strGroupName"] + " group. <br><br>"
                            //    + "Thanks," + "<br>"
                            //    + "The Skorkel Team<br><br>"
                            //    + "****This is a system generated Email. Kindly do not reply****", null, "text/html");

                            using (StreamReader reader = new StreamReader(Server.MapPath("~/EmailTemplate.htm")))
                            {
                                body = reader.ReadToEnd();
                            }
                            if (ViewState["join"].ToString() == "A")
                            {
                                string MailUrlFinal = MailURL + "/Group-Profile.aspx?GrpId=" + Convert.ToInt32(ViewState["GroupOutId"]);
                                body = body.Replace("{UserName}", name);
                                body = body.Replace("{Content}", "<b>" + dtRecord.Rows[0]["Name"] + "</b>" +
                                                    " added you to the " + ViewState["strGroupName"] + " group. <br>" +
                                                    "Please click below to view group details: " +
                                                    "<br><a href = '" + MailUrlFinal + "' style='background:#01B7BD;padding:5px 10px;border-radius:15px;color:#fff;text-decoration: none;'>View Details</a>");
                                body = body.Replace("{RedirectURL}", MailURL);

                                htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html);

                                Rmm2.To.Clear();
                                Rmm2.To.Add(MailTo);
                                //Rmm2.Subject = "Skorkel Group Joining Request.";
                                Rmm2.Subject = ViewState["strGroupName"] + " Skorkel Group included you, By " + dtRecord.Rows[0]["Name"];
                            }
                            else if (ViewState["join"].ToString() == "R")
                            {
                                string MailUrlFinal = MailURL + "/Group-Profile.aspx?GrpId=" + Convert.ToInt32(ViewState["GroupOutId"]);
                                body = body.Replace("{UserName}", name);
                                body = body.Replace("{Content}", "<b>" + dtRecord.Rows[0]["Name"] + "</b>" +
                                                    " added you to the " + ViewState["strGroupName"] + " group. <br>" +
                                                    "Please click below to view group details: " +
                                                    "<br><a href = '" + MailUrlFinal + "' style='background:#01B7BD;padding:5px 10px;border-radius:15px;color:#fff;text-decoration: none;'>View Details</a>");
                                body = body.Replace("{RedirectURL}", MailURL);

                                htmlView = System.Net.Mail.AlternateView.CreateAlternateViewFromString(body, null, MediaTypeNames.Text.Html);

                                Rmm2.To.Clear();
                                Rmm2.To.Add(MailTo);
                                //Rmm2.Subject = "Skorkel Group Joining Request.";
                                Rmm2.Subject = ViewState["strGroupName"] + " Skorkel Group included you, By " + dtRecord.Rows[0]["Name"];
                            }
                            Rmm2.AlternateViews.Add(htmlView);
                            Rmm2.IsBodyHtml = true;
                            clientip.Send(Rmm2);
                            Rmm2.To.Clear();
                            // ViewState["TotalMailId"] = TotalMailId;
                        }
                    }
                }
            }
            catch (FormatException ex)
            {
                ex.Message.ToString();
                return;
            }
            catch (SmtpException ex)
            {
                ex.Message.ToString();
                return;
            }
            finally
            {
                conn.Close();
            }
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }
    }