当前位置: 首页>>代码示例>>C#>>正文


C# finalContext.Entry方法代码示例

本文整理汇总了C#中LoanManagement.Domain.finalContext.Entry方法的典型用法代码示例。如果您正苦于以下问题:C# finalContext.Entry方法的具体用法?C# finalContext.Entry怎么用?C# finalContext.Entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LoanManagement.Domain.finalContext的用法示例。


在下文中一共展示了finalContext.Entry方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: btnApply_Click

        protected void btnApply_Click(object sender, EventArgs e)
        {
            try
            {
                if (Session["ID"] == null)
                {
                    Response.Redirect("/Index.aspx");
                }
                if (txtCaptcha.Text == "")
                {
                    lblCaptcha.Visible = true;
                    return;
                }
                CaptchaControl1.ValidateCaptcha(txtCaptcha.Text);
                if (!CaptchaControl1.UserValidated)
                {
                    lblCaptcha.Visible = true;
                    return;
                }
                else
                {
                    lblCaptcha.Visible = !true;
                }
                using (var ctx = new finalContext())
                {
                    double val = Convert.ToDouble(txtAmt.Text);
                    var ser = ctx.Services.Find(Convert.ToInt32(Session["Service"]));
                    if (val > ser.MaxValue || val < ser.MinValue)
                    {
                        lblError.Text = "Invalid Loan Amount";
                        lblError.Visible = true;
                        return;
                    }
                    val = Convert.ToDouble(txtTerm.Text);
                    if (val > ser.MaxTerm || val < ser.MinTerm)
                    {
                        lblError.Text = "Invalid Desired Term";
                        lblError.Visible = true;
                        return;
                    }
                    int n = Convert.ToInt32(Session["ID"]);
                    var c = ctx.TemporaryLoanApplications.Where(x => x.ClientID == n).Count();
                    if (c > 0)
                    {
                        using (var ictx = new finalContext())
                        {
                            int num = Convert.ToInt32(Session["ID"]);
                            var ln = ictx.TemporaryLoanApplications.Where(x => x.ClientID == num).First();
                            ln.Mode = cmbMode.Text;
                            ln.AmountApplied = Convert.ToDouble(txtAmt.Text);
                            ln.Term = Convert.ToInt32(txtTerm.Text);
                            ln.ServiceID = ser.ServiceID;
                            ictx.Entry(ln).State = System.Data.EntityState.Modified;
                            ictx.SaveChanges();

                            Session["tempLoan"] = ln.TemporaryLoanApplicationID.ToString();
                            Response.Redirect("/ApplicationSuccess.aspx");
                            //Response.Redirect("/MyAccount_Loans.aspx");
                            return;
                        }
                    }

                    TemporaryLoanApplication lon = new TemporaryLoanApplication { AmountApplied = Convert.ToDouble(txtAmt.Text), ClientID = Convert.ToInt32(Session["ID"]), DateApplied = DateTime.Now.Date, ExpirationDate = DateTime.Now.Date.AddMonths(1), Mode = cmbMode.Text, ServiceID = Convert.ToInt32(Session["Service"]), Term = Convert.ToInt32(txtTerm.Text) };
                    ctx.TemporaryLoanApplications.Add(lon);
                    ctx.SaveChanges();
                    Session["tempLoan"] = lon.TemporaryLoanApplicationID.ToString();
                    string folderName = @"F:\Loan Files\Applications Online";
                    string pathString = System.IO.Path.Combine(folderName, "Application " + Session["tempLoan"]);
                    if (!Directory.Exists(pathString))
                    {
                        System.IO.Directory.CreateDirectory(pathString);
                    }
                    else
                    {
                        Directory.Delete(pathString, true);
                        System.IO.Directory.CreateDirectory(pathString);
                    }
                    Response.Redirect("/ApplicationSuccess.aspx");

                }
            }
            catch (Exception)
            {
                //Response.Redirect("/Index.aspx");
            }
        }
开发者ID:stisf-g1,项目名称:LoanManagement,代码行数:86,代码来源:Application.aspx.cs


注:本文中的LoanManagement.Domain.finalContext.Entry方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。