Exemplo n.º 1
0
        public ActionResult Edit(EditPropertyVM model)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Index", "Account"));
            }
            ViewBag.ReportTitle = "Edit Property";

            PropertyManager.Edit(model);
            return(RedirectToAction("Index"));
        }
Exemplo n.º 2
0
        public static void Edit(EditPropertyVM model)
        {
            using (SqlConnection connection = new SqlConnection(Helpers.Helpers.GetAppConnectionString()))
            {
                try
                {
                    // Create the user record.
                    SqlCommand cmd = new SqlCommand("", connection);
                    connection.Open();
                    StringBuilder sb = new StringBuilder();
                    sb.Append(" update tblProperty set ");
                    sb.Append(" PurchaseDate ='" + model.PurchaseDate + "',");
                    sb.Append(" Address ='" + model.Address + "',");
                    sb.Append(" City ='" + model.City + "',");
                    sb.Append(" Zip ='" + model.Zip + "',");
                    sb.Append(" PurchasePrice =" + model.PurchasePrice + ",");
                    sb.Append(" PropertyTaxYearPayment =" + model.PropertyTaxYearPayment + ",");
                    sb.Append(" PropertyTaxMailingAddress ='" + model.PropertyTaxMailingAddress + "',");
                    sb.Append(" PropertyTaxDueDate ='" + model.PropertyTaxDueDate + "',");
                    sb.Append(" StatusID =" + model.StatusID + ",");
                    sb.Append(" note ='" + model.note + "',");
                    sb.Append(" InterestRate =" + model.InterestRate + ",");
                    sb.Append(" LoanAmount =" + model.LoanAmount + ",");
                    sb.Append(" InsuranceCompany ='" + model.InsuranceCompany + "',");
                    sb.Append(" InsurancePremium =" + model.InsurancePremium + ",");
                    sb.Append(" InsurancePolicyNumber ='" + model.InsurancePolicyNumber + "',");
                    sb.Append(" InsuranceDueDate ='" + model.InsuranceDueDate + "',");
                    sb.Append(" InsuranceBillMailingAddress ='" + model.InsuranceBillMailingAddress + "',");
                    sb.Append(" SoldDate ='" + model.SoldDate + "',");
                    sb.Append(" amortization =" + model.amortization + ",");
                    sb.Append(" CurrentEstimateMarketValue =" + model.CurrentEstimateMarketValue + ",");
                    sb.Append(" ShareHoldPercentage =" + model.ShareHoldPercentage);
                    sb.Append(" where PropertyID = " + model.PropertyID);
                    cmd.CommandText = sb.ToString();
                    cmd.ExecuteNonQuery();

                    //update company id for property
                    sb.Clear();
                    sb.Append("update mCompanyProperty set CompanyID = " + model.CompanyID + " where propertyID=" + model.PropertyID);
                    cmd.CommandText = sb.ToString();
                    cmd.ExecuteNonQuery();
                }
                catch (Exception ex)
                {
                    throw new Exception(ex.Message);
                }
                finally
                {
                    connection.Close();
                }
            }
        }
Exemplo n.º 3
0
        public ActionResult Edit(int id)
        {
            if (Session["UserName"] == null)
            {
                return(RedirectToAction("Index", "Account"));
            }
            ViewBag.ReportTitle = "Edit Property";

            var property = PropertyManager.GetByID(id);
            var model    = new EditPropertyVM()
            {
                PropertyID                  = property.PropertyID,
                PurchaseDate                = property.PurchaseDate,
                Address                     = property.Address,
                City                        = property.City,
                Zip                         = property.Zip,
                PurchasePrice               = property.PurchasePrice,
                PropertyTaxYearPayment      = property.PropertyTaxYearPayment,
                PropertyTaxMailingAddress   = property.PropertyTaxMailingAddress,
                PropertyTaxDueDate          = property.PropertyTaxDueDate,
                StatusID                    = property.StatusID,
                note                        = property.note,
                InterestRate                = property.InterestRate,
                LoanAmount                  = property.LoanAmount,
                InsuranceCompany            = property.InsuranceCompany,
                InsurancePremium            = property.InsurancePremium,
                InsurancePolicyNumber       = property.InsurancePolicyNumber,
                InsuranceDueDate            = property.InsuranceDueDate,
                InsuranceBillMailingAddress = property.InsuranceBillMailingAddress,
                SoldDate                    = property.SoldDate,
                amortization                = property.amortization,
                CurrentEstimateMarketValue  = property.CurrentEstimateMarketValue,
                ShareHoldPercentage         = property.ShareHoldPercentage,
                CompanyID                   = property.CompanyID
            };

            model.AllStatus  = GetSelectListItems((short)Helpers.Helpers.ListType.allStatus);
            model.AllCompany = GetSelectListItems((short)Helpers.Helpers.ListType.company);

            return(View(model));
        }