Example #1
0
        public async Task <int> CreateFlatSaleAsync(FlatSale flatSale, CancellationToken ct)
        {
            try
            {
                using var context = contextFactory.GetAdvContext();
                await context.FlatSales.AddAsync(flatSale, ct).ConfigureAwait(false);

                var result = await context.SaveChangesAsync(ct).ConfigureAwait(false);

                return(result > 0 ? flatSale.Id : throw new BadCreateException("Мы не смогли создать объявление"));
            }
            catch (Exception e)
            {
                Debug.WriteLine(e);
                throw;
            }
        }
 // Save New Customer data (Booking or sale)
 public HttpResponseMessage SaveCustomer(FlatSale newCust)
 {
     int ii = newCust.PlanID.Value;
     try
     {
         if (newCust.AppTitle == null) newCust.AppTitle = "";
         if (newCust.AppFName == null) newCust.AppFName = "";
         if (newCust.AppMName == null) newCust.AppMName = "";
         if (newCust.AppLName == null) newCust.AppLName = "";
         if (newCust.CoTitle == null) newCust.CoTitle = "";
         if (newCust.CoFName == null) newCust.CoFName = "";
         if (newCust.CoMName == null) newCust.CoMName = "";
         if (newCust.CoLName == null) newCust.CoLName = "";
         DateTimeFormatInfo dtinfo = new DateTimeFormatInfo();
         dtinfo.DateSeparator = "/";
         dtinfo.ShortDatePattern = "dd/MM/yyyy";
         newCust.BookingDate = Convert.ToDateTime(newCust.SrtSaleDate, dtinfo);
         //newCust.BookingDate = newCust.SaleDate;
         int i = SbpEntity.INSERT_RBookFlat(newCust.FlatName, newCust.SaleDate, newCust.BookingAmount, newCust.AppFName, newCust.AppMName, newCust.AppLName, newCust.Title,
         newCust.PName, newCust.Address1, newCust.Address2, newCust.City, newCust.Distt, newCust.State, newCust.Country, newCust.AppPAN, newCust.MobileNo, newCust.DateOfBirth,
         newCust.CoFName, newCust.CoMName, newCust.CoLName, newCust.CoAddress1,
         newCust.CoAddress2, newCust.CoCity, newCust.CoState, newCust.CoCountry, newCust.CoPAN, newCust.CoMobileNo, newCust.AlternateMobile, newCust.LandLine,
         newCust.EmailID, newCust.AlternateEmail, newCust.LoanAmount, newCust.LienField, newCust.BankID, newCust.IsPAN,
         newCust.IsPhoto, newCust.IsAddressPf, newCust.Type, newCust.CustomerID, newCust.SecCoFName, newCust.SecCoMName, newCust.SecCoLName, newCust.SecCoAddress1,
         newCust.SecCoAddress2, newCust.SecCoCity, newCust.SecCoState, newCust.SecCoCountry, newCust.SecCoMobileNo, newCust.SecCoPAN,
         newCust.CoTitle, newCust.CoPName, newCust.SecCoTitle, newCust.SecCoPName, newCust.IsConstruction, newCust.AppTitle, newCust.CoAppTitle, newCust.SecCoAppTitle, newCust.IsRationCard, newCust.IsDrivingLicence, newCust.IsVoterCard, newCust.IsPassport, newCust.PhotoImagePath, newCust.AddPfImagePath, newCust.DVImagePath, newCust.VoterCardImagePath, newCust.PassportImagePath,
         newCust.RationCardImagePath, newCust.Remarks, newCust.CoDOB, newCust.SecCoDOB, newCust.PANImagePath, newCust.CoIsPAN, newCust.CoIsPhoto, newCust.CoIsAddressPf, newCust.CoIsRationCard, newCust.CoIsDrivingLicence, newCust.CoIsVoterCard, newCust.CoIsPassport, newCust.CoPhotoImagePath, newCust.CoAddPfImagePath, newCust.CoDVImagePath, newCust.CoVoterCardImagePath, newCust.CoPhotoImagePath,
         newCust.CoRationCardImagePath, newCust.CoPANImagePath, newCust.SecCoIsPAN, newCust.SecCoIsPhoto, newCust.CoIsAddressPf, newCust.SecCoIsRationCard, newCust.SecCoIsDrivingLicence, newCust.SecCoIsVoterCard, newCust.SecCoIsPassport, newCust.SecCoPhotoImagePath,
         newCust.SecCoAddPfImagePath, newCust.SecCoDVImagePath, newCust.SecCoVoterCardImagePath, newCust.SecCoPhotoImagePath, newCust.SecCoRationCardImagePath, newCust.SecCoPhotoImagePath, newCust.BankBranch, newCust.PinCode, newCust.ExecutiveName, newCust.CoPinCode, newCust.SecCoPinCode, newCust.TransferAmount, newCust.affidavit, newCust.PropertyID, newCust.PaymentFor, newCust.BookingDate, newCust.PropertyTypeID, newCust.PropertySizeID, newCust.PlanID, User.Identity.Name, newCust.SaleRate, newCust.SaleRateInWords);
         DataTable dt = obj.GetDataTable("select FlatID from tblsFlat where FlatName='" + newCust.FlatName + "' and PID='" + newCust.PropertyID + "' and Status=1");
         if (dt.Rows.Count > 0)
         {
             Session["FlatId"] = dt.Rows[0]["FlatID"].ToString();
         }
         else
         {
             Session["FlatId"] = newCust.FlatID;
         }
         Session["PID"] = newCust.PropertyID;
         Session["FlatName"] = newCust.FlatName;
     }
     catch (Exception ex)
     {
         Helper hp = new Helper();
         hp.LogException(ex);
     }
     return new HttpResponseMessage(HttpStatusCode.Created);
 }