Exemple #1
0
        public IHttpActionResult AccountDetail(AccountDetailDto accountDetailDto)
        {
            try
            {
                var accountDetail = entity.accountdetails.Where(x => x.type == accountDetailDto.type).First();
                accountDetail.title   = accountDetailDto.title;
                accountDetail.para1   = accountDetailDto.para1;
                accountDetail.para2   = accountDetailDto.para2;
                accountDetail.heading = accountDetailDto.heading;
                entity.SaveChanges();
                return(Ok(accountDetail));
            }
            catch (Exception ex)
            {
                var accountDetail = new accountdetail
                {
                    type    = accountDetailDto.type,
                    title   = accountDetailDto.title,
                    para1   = accountDetailDto.para1,
                    para2   = accountDetailDto.para2,
                    heading = accountDetailDto.heading
                };

                entity.accountdetails.Add(accountDetail);
                entity.SaveChanges();
                return(Ok(accountDetail));
            }
        }
Exemple #2
0
        public IHttpActionResult GetAccountDetail(string type)
        {
            accountdetail accountDetail = null;

            try
            {
                accountDetail = entity.accountdetails.Where(x => x.type == type).First();
                return(Ok(accountDetail));
            }
            catch (Exception ex)
            {
                return(Ok(accountDetail));
            }
        }
Exemple #3
0
        public IHttpActionResult AccountDetailPanel6(AccountDetailPanel6Dto accountDetailPanel1Dto)
        {
            try
            {
                var accountDetail = entity.accountdetails.Where(x => x.type == accountDetailPanel1Dto.type).First();
                accountDetail.panel6title = accountDetailPanel1Dto.panel6Title;

                accountDetail.panel6subtitle1        = accountDetailPanel1Dto.panel6Subtitle1;
                accountDetail.panel6subtitle1content = accountDetailPanel1Dto.panel6Subtitle1Content;

                accountDetail.panel6subtitle2        = accountDetailPanel1Dto.panel6Subtitle2;
                accountDetail.panel6subtitle2content = accountDetailPanel1Dto.panel6Subtitle2Content;

                accountDetail.panel6subtitle3        = accountDetailPanel1Dto.panel6Subtitle3;
                accountDetail.panel6subtitle3content = accountDetailPanel1Dto.panel6Subtitle3Content;

                entity.SaveChanges();
                return(Ok(accountDetail));
            }
            catch (Exception ex)
            {
                var accountDetail = new accountdetail
                {
                    type = accountDetailPanel1Dto.type,

                    panel6title = accountDetailPanel1Dto.panel6Title,

                    panel6subtitle1        = accountDetailPanel1Dto.panel6Subtitle1,
                    panel6subtitle1content = accountDetailPanel1Dto.panel6Subtitle1Content,

                    panel6subtitle2        = accountDetailPanel1Dto.panel6Subtitle2,
                    panel6subtitle2content = accountDetailPanel1Dto.panel6Subtitle2Content,

                    panel6subtitle3        = accountDetailPanel1Dto.panel6Subtitle3,
                    panel6subtitle3content = accountDetailPanel1Dto.panel6Subtitle3Content
                };

                entity.accountdetails.Add(accountDetail);
                entity.SaveChanges();
                return(Ok(accountDetail));
            }
        }
Exemple #4
0
    protected void Proceedbtn_Click(object sender, EventArgs e)
    {
        #region Error-Validation
        if (cardnotxt.Text.Length != 16)
        {
            cautionlbl.Text      = "Invalid card number.Please enter the 16 digit card number again.";
            cautionlbl.ForeColor = Color.Red;
            return;
        }
        if (cvvtxt.Text.Length != 3)
        {
            cautionlbl.Text      = "Invalid cvv number.Please enter the 3 digit cvv number again.";
            cautionlbl.ForeColor = Color.Red;
            return;
        }
        if (nametxt.Text.Length == 0)
        {
            cautionlbl.Text      = "Please enter a valid name.";
            cautionlbl.ForeColor = Color.Red;
            return;
        }

        char[] cardno = cardnotxt.Text.ToCharArray();
        int    length = cardno.Length;
        for (int i = 0; i < length; i++)
        {
            if (!char.IsDigit(cardno[i]))
            {
                cautionlbl.Text      = "Only number is allowed in card number.";
                cautionlbl.ForeColor = Color.Red;
                return;
            }
        }
        #endregion

        #region logica-part
        int    amount   = Convert.ToInt32(Session["amount"].ToString());
        string username = Session["username"].ToString();
        using (var context = new Testdata1Entities())
        {
            string cash = "";
            var    a    = from u in context.accountdetails
                          where u.user_name == username
                          select u;
            var b = a.FirstOrDefault();
            if (b != null)
            {
                cash      = (Convert.ToInt32(b.balance) + amount).ToString();
                b.balance = cash;

                context.SaveChanges();
                Session["amount"] = cash;
            }
            else
            {
                cash = amount.ToString();
                accountdetail d = new accountdetail();
                d.balance   = cash;
                d.user_name = username;
                context.accountdetails.Add(d);
                context.SaveChanges();
            }
        }
        Session["redirect"] = "success";
        Response.Write("<script>");
        Response.Write("window.open('UserProfile.aspx','_parent')");
        Response.Write("</script>");
        #endregion
    }