Пример #1
0
        public void Update_Interest_Should_Return_Success_Result(string interestName, string interestDescription)
        {
            var mockInterest = Interest.Create(interestName, interestDescription);

            _testInterest.UpdateInterest(mockInterest.Value);
            _testInterest.InterestDescription.Should().Be(interestDescription);
            _testInterest.InterestName.Should().Be(interestName);
        }
Пример #2
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);
    }