コード例 #1
0
    protected void bindgrid(string InterestCode)
    {
        try
        {
            DataTable Dt = new DataTable();
            Dt = objInterest.GetInterest(" where InterestCode='" + InterestCode + "'");
            if (Dt.Rows.Count > 0)
            {
                l = Dt.Rows.Count;
                EntGridView.DataSource = Dt;
                EntGridView.DataBind();
                EntGridView.Visible = true;
                no_data.Visible     = false;
            }
            else
            {
                EntGridView.Visible = false;
                no_data.Visible     = true;
                UpdAdd.Update();
            }
        }


        catch (Exception ex)
        {
            if (this.global_success.Visible)
            {
                this.global_success.Visible = false;
            }
            this.global_error.Visible  = true;
            this.global_error_msg.Text = Mains.Constant.GENERAL_ERR;
        }
    }
コード例 #2
0
    protected void BtnDelete_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString())))
            {
                if (this.global_success.Visible)
                {
                    this.global_success.Visible = false;
                }
                this.global_error.Visible  = true;
                this.global_error_msg.Text = Mains.Constant.FAIL_CRUD;
                UpdAdd.Update();
                upCrudGrid.Update();
                upDel.Update();
                bindgrid();
                sb.Append(@"<script type='text/javascript'>");
                sb.Append("$('#deleteModal').modal('hide');");
                sb.Append(@"</script>");
                ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "delHideModalScript", sb.ToString(), false);
                return;
            }

            else
            {
                if (this.global_error.Visible)
                {
                    this.global_error.Visible = false;
                }
                this.global_success.Visible  = true;
                this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE;
                UpdAdd.Update();
                upDel.Update();
                upCrudGrid.Update();
                bindgrid();
            }
        }

        catch (Exception ex)
        {
        }

        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#deleteModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "delHideModalScript", sb.ToString(), false);
    }
コード例 #3
0
    protected void BtnSave_Click(object sender, EventArgs e)
    {
        System.Text.StringBuilder sb = new System.Text.StringBuilder();
        try
        {
            DataTable dtSubscriber = objSubscriber.GetSubscriber(" where SubscriberEmail=" + txtSubEmail.Text + " and InterestStatus=true and InterestSector=" + ddlSectorInterest.SelectedValue + " and InterestArea=" + ddlAreaInterest.SelectedValue);
            if (dtSubscriber.Rows.Count > 0)
            {
                if (this.global_error.Visible)
                {
                    this.global_error.Visible = false;
                }
                this.global_success.Visible  = true;
                this.global_success_msg.Text = "This subscription already exist in the Contact List.";
                UpdAdd.Update();
                upEdit.Update();
            }
            else
            {
                string motif = string.Empty;

                string strmsg = "";
                objInterest.InterestID         = 0;
                objInterest.InterestSector     = int.Parse(ddlSectorInterest.SelectedValue);
                objInterest.InterestArea       = int.Parse(ddlAreaInterest.SelectedValue);
                objInterest.InterestSubscriber = int.Parse(Session[RunningCache.SubscriberID].ToString());
                objInterest.LastModifiedBy     = 0;
                objInterest.LastModifiedDate   = DateTime.Now;
                if (BtnSave.Text.ToUpper() == "Save".ToUpper())
                {
                    objInterest.SaveInterest(objInterest, out strmsg);
                    if (this.global_error.Visible)
                    {
                        this.global_error.Visible = false;
                    }
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The Interest is successfully saved into the system.";
                    UpdAdd.Update();
                }


                else if (BtnSave.Text.ToUpper() == "UPDATE".ToUpper())
                {
                    objInterest.InterestID = int.Parse(Session[RunningCache.InterestID].ToString());
                    objInterest.UpdateInterest(objInterest, out strmsg);
                    this.global_success.Visible  = true;
                    this.global_success_msg.Text = "The Interest is successfully updated into the system.";
                    UpdAdd.Update();
                }
            }

            upCrudGrid.Update();
            bindgrid();
            filldataSubscriber(dtSubscriber.Rows[0]["SubscriberEmail"].ToString(), dtSubscriber.Rows[0]["SubscriberCode"].ToString());
        }

        catch (Exception ex)
        {
        }


        sb.Append(@"<script type='text/javascript'>");

        sb.Append("$('#addEdiModal').modal('hide');");

        sb.Append(@"</script>");

        ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "EditHideModalScript", sb.ToString(), false);
    }
コード例 #4
0
    protected void BtnAddInterest_Click(object sender, EventArgs e)
    {
        try
        {
            if (this.subscription_error.Visible)
            {
                this.subscription_error.Visible = false;
            }

            if (string.IsNullOrEmpty(ddlAreaInterest.SelectedValue) || string.IsNullOrEmpty(ddlSectorInterest.SelectedValue))
            {
                if (this.global_success.Visible)
                {
                    this.global_success.Visible = false;
                }
                this.global_error.Visible  = true;
                this.global_error_msg.Text = "Please select a Sector and an Area";
            }
            else
            {
                DataTable dtSubscriber = objSubscriber.GetSubscriber(" where SubscriberEmail='" + txtSubEmail.Text + "' and InterestSector=" + ddlSectorInterest.SelectedValue + " and InterestArea=" + ddlAreaInterest.SelectedValue);
                if (dtSubscriber.Rows.Count > 0)
                {
                    if (this.global_success.Visible)
                    {
                        this.global_success.Visible = false;
                    }
                    this.global_error.Visible  = true;
                    this.global_error_msg.Text = dtSubscriber.Rows[0]["SectorInterestName"].ToString() + " - " + dtSubscriber.Rows[0]["AreaInterestName"].ToString() + " already exist in your interest list";
                    UpdAdd.Update();
                    upEdit.Update();
                }
                else
                {
                    string strmsg = string.Empty;
                    objInterest.InterestID         = 0;
                    objInterest.InterestSector     = int.Parse(ddlSectorInterest.SelectedValue);
                    objInterest.InterestArea       = int.Parse(ddlAreaInterest.SelectedValue);
                    objInterest.InterestSubscriber = int.Parse(Session[RunningCache.SubscriberID].ToString());
                    objInterest.InterestStatus     = true;
                    objInterest.InterestCode       = GetUniqueKey(6);
                    objInterest.LastModifiedBy     = int.Parse(Session[RunningCache.UserID].ToString());
                    objInterest.LastModifiedDate   = DateTime.Now;

                    Session[RunningCache.InterestID] = objInterest.SaveInterest(objInterest, out strmsg);

                    DataTable dt = objInterest.GetInterest(" where InterestID=" + int.Parse(Session[RunningCache.InterestID].ToString()));
                    if (dt.Rows.Count > 0)
                    {
                        if (this.global_error.Visible)
                        {
                            this.global_error.Visible = false;
                        }
                        this.global_success.Visible  = true;
                        this.global_success_msg.Text = dt.Rows[0]["SectorInterestName"].ToString() + " - " + dt.Rows[0]["AreaInterestName"].ToString() + " has been added to your interest list";
                    }

                    UpdAdd.Update();
                    upEdit.Update();

                    upCrudGrid.Update();
                    bindgrid();

                    filldataSubscriber(dtSubscriber.Rows[0]["SubscriberEmail"].ToString(), dtSubscriber.Rows[0]["SubscriberCode"].ToString());
                }
            }
        }

        catch (Exception ex)
        {
        }
    }
コード例 #5
0
    protected void BtnSubscribe_Click(object sender, EventArgs e)
    {
        try
        {
            if (string.IsNullOrEmpty(txtSubEmail.Text.Trim()) == false)
            {
                if (IsValid(txtSubEmail.Text.Trim()))
                {
                    string strmsg = "";
                    objSubscriber.SubscriberID           = 0;
                    objSubscriber.SubscriberFullName     = txtSubFullName.Text;
                    objSubscriber.SubscriberEmail        = txtSubEmail.Text.Trim();
                    objSubscriber.SubscriberTitle        = txtSubTitle.Text;
                    objSubscriber.SubscriberOrganization = txtSubOrganization.Value;
                    objSubscriber.SubscriberContact      = txtSubContact.Text;
                    objSubscriber.SubscriberInterest     = 0;
                    objSubscriber.LastModifiedBy         = txtSubEmail.Text.Trim();
                    objSubscriber.LastModifiedDate       = DateTime.Now;
                    objSubscriber.SubscriberAddedDate    = DateTime.Now;
                    objSubscriber.SubscriberCode         = GetUniqueKey(6);

                    //this datatable and GetSubscriberRaw will list all the email in the raw Subscriver table
                    if (BtnSubscribe.Text.ToUpper().Trim() == "Subscribe".ToUpper().Trim())
                    {
                        DataTable dtSubscriber = objSubscriber.GetSubscriberRaw(" where SubscriberEmail='" + txtSubEmail.Text.Trim() + "'");
                        if (dtSubscriber.Rows.Count > 0)
                        {
                            objSubscriber.CustomUpdateSubscriber(" SubscriberCode='" + objSubscriber.SubscriberCode + "' WHERE SubscriberEmail='" + txtSubEmail.Text.Trim() + "'");
                        }
                        else
                        {
                            Session[RunningCache.SubscriberID] = objSubscriber.SaveSubscriber(objSubscriber, out strmsg);
                        }

                        string strURL = "use your hosting web folder/subscription.aspx?from=fu&vid=" + txtSubEmail.Text.Trim() + "&strflags=" + objSubscriber.SubscriberCode;
                        SendEmail(txtSubEmail.Text.Trim(), "ContactHub Subscription", txtSubFullName.Text.Trim(), strURL);

                        if (this.subscription_error.Visible)
                        {
                            this.subscription_error.Visible = false;
                        }
                        this.subcription_success.Visible  = true;
                        this.subcription_success_msg.Text = "An email has been sent to " + txtSubEmail.Text.Trim() + ". Please browse the link to continue.";
                    }

                    else if (BtnSubscribe.Text.ToUpper() == "Confirm".ToUpper())
                    {
                        objSubscriber.SubscriberID = int.Parse(Session[RunningCache.SubscriberID].ToString());
                        objSubscriber.UpdateSubscriberConfirm(objSubscriber, out strmsg);
                        if (this.global_success.Visible)
                        {
                            this.global_success.Visible = false;
                        }
                        this.subcription_success.Visible  = true;
                        this.subcription_success_msg.Text = "Information successfully updated for " + txtSubFullName.Text;
                        UpdAdd.Update();
                        DivGrid.Visible = true;

                        foreach (GridViewRow gvrow in EntGridView.Rows)
                        {
                            try
                            {
                                Label       InterestSector = (Label)gvrow.FindControl("SectorInterestName");
                                Label       InterestArea   = (Label)gvrow.FindControl("AreaInterestName");
                                HiddenField InterestID     = (HiddenField)gvrow.FindControl("InterestID");
                                HiddenField SectorID       = (HiddenField)gvrow.FindControl("InterestSector");
                                HiddenField AreaID         = (HiddenField)gvrow.FindControl("InterestArea");

                                Session[RunningCache.InterestID] = Convert.ToInt32(InterestID.Value);
                                objInterest.CustomUpdateInterest(" InterestStatus=1 WHERE InterestID=" + Session[RunningCache.InterestID].ToString());

                                DataTable dtInterestCode = objInterest.GetInterest(" where InterestID=" + Convert.ToInt32(InterestID.Value));
                                string    InterestCode   = dtInterestCode.Rows[0]["InterestCode"].ToString();

                                //Getting all the focal point list
                                DataTable dtFocalPoint = objFocalPoints.GetFocalPoints(" where FocalPointsSector=" + Convert.ToInt32(SectorID.Value) + " and FocalPointsArea=" + Convert.ToInt32(AreaID.Value));
                                for (int i = 0; i < dtFocalPoint.Rows.Count; i++)
                                {
                                    if (dtFocalPoint.Rows[i]["FocalPointsNotification"].ToString() == "True")
                                    {
                                        //Send email to distinct Focal Points
                                        DataTable dtUser = objUsers.GetUsers(" where UserID=" + dtFocalPoint.Rows[i]["FocalPointsUser"].ToString());
                                        string    subscriber;
                                        if (string.IsNullOrEmpty(txtSubFullName.Text.Trim()))
                                        {
                                            subscriber = txtSubEmail.Text.Trim();
                                        }
                                        else
                                        {
                                            subscriber = txtSubEmail.Text.Trim() + " (" + txtSubFullName.Text.Trim() + ")";
                                        }

                                        string strURL = "use your hosting web folder/unsubscription.aspx?from=fu&vid=" + InterestCode;
                                        SendNotification(dtUser.Rows[0]["UserMail"].ToString().Trim(), "ContactHub Notification Email", dtFocalPoint.Rows[i]["UserFullName"].ToString(), subscriber, strURL, dtFocalPoint.Rows[i]["SectorInterestName"].ToString(), dtFocalPoint.Rows[i]["AreaInterestName"].ToString());
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                if (this.subscription_error.Visible)
                                {
                                    this.subscription_error.Visible = true;
                                }
                                this.subcription_success.Visible = false;
                                this.subscription_error_msg.Text = Mains.Constant.INVALID_EMAIL;
                                UpdAdd.Update();
                            }
                        }
                    }
                }
                else
                {
                    if (this.subcription_success.Visible)
                    {
                        this.subcription_success.Visible = false;
                    }
                    this.subscription_error.Visible  = true;
                    this.subscription_error_msg.Text = "Please enter a valid email address.";
                }
            }
            else
            {
                if (this.subcription_success.Visible)
                {
                    this.subcription_success.Visible = false;
                }
                this.subscription_error.Visible  = true;
                this.subscription_error_msg.Text = "Please enter an email address.";
            }
        }

        catch (Exception ex)
        {
        }
    }
コード例 #6
0
    protected void EntGridView_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        try
        {
            int    index = Convert.ToInt32(e.CommandArgument) % EntGridView.PageSize;
            string HDnID = ((HiddenField)EntGridView.Rows[index].FindControl("InterestID")).Value;
            string SectorInterestName = ((Label)EntGridView.Rows[index].FindControl("SectorInterestName")).Text;
            string AreaInterestName   = ((Label)EntGridView.Rows[index].FindControl("AreaInterestName")).Text;

            Session[RunningCache.InterestID] = HDnID;

            if (e.CommandName.Equals("view"))
            {
                try
                {
                    bindSectorInterest();
                    bindAreaInterest();
                    DataTable dtInterest = objInterest.GetInterest(" where InterestID='" + HDnID + "'");
                    ddlSectorInterest1.SelectedValue = dtInterest.Rows[0]["InterestSector"].ToString();
                    ddlAreaInterest1.SelectedValue   = dtInterest.Rows[0]["InterestArea"].ToString();
                    BtnSave.Text = "Update";
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    sb.Append(@"<script type='text/javascript'>");
                    sb.Append("$('#addEdiModal').modal('show');");
                    sb.Append(@"</script>");
                    ToolkitScriptManager.RegisterClientScriptBlock(this, this.GetType(), "addEdiModalScript", sb.ToString(), false);
                    upEdit.Update();
                }
                catch (Exception ex)
                {
                }
            }

            if (e.CommandName.Equals("deleting"))
            {
                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                try
                {
                    if (!(objInterest.DeleteInterest(Session[RunningCache.InterestID].ToString())))
                    {
                        if (this.global_success.Visible)
                        {
                            this.global_success.Visible = false;
                        }
                        this.global_error.Visible  = true;
                        this.global_error_msg.Text = Mains.Constant.FAIL_CRUD;
                        UpdAdd.Update();
                        upCrudGrid.Update();
                        upDel.Update();
                        bindgrid();

                        return;
                    }

                    else
                    {
                        if (this.global_error.Visible)
                        {
                            this.global_error.Visible = false;
                        }
                        this.global_success.Visible  = true;
                        this.global_success_msg.Text = Mains.Constant.SUCCESS_DELETE;
                        UpdAdd.Update();
                        upDel.Update();
                        upCrudGrid.Update();
                        bindgrid();
                    }
                }

                catch (Exception ex)
                {
                }
            }
        }
        catch (Exception ex)
        {
        }
    }