Beispiel #1
0
 /// <summary>
 /// code for updation of property details
 /// </summary>
 /// <param name="ids"></param>
 /// <param name="price"></param>
 /// <param name="_for"></param>
 /// <returns></returns>
 public static int updatePropertyDetails(int ids, string add, long price, int bed, int bath, long area, string _for, int flat)
 {
     try
     {
         using (var objdata = new HavanadataclassesDataContext())
         {
             tblProperty property = objdata.tblProperties.Where(x => x.Id == ids).FirstOrDefault();
             if (property != null)
             {
                 property.Address  = add;
                 property.Bedroom  = bed;
                 property.Bathroom = bath;
                 property.Area     = area;
                 property.Price    = Convert.ToInt64(price);
                 property.For      = _for;
                 property.FlatId   = flat;
             }
             objdata.SubmitChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #2
0
        public IHttpActionResult PuttblProperty(int id, tblProperty tblProperty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            using (db)
            {
                var cust = db.tblProperties.Where(g => g.Prop_id.Equals(id)).FirstOrDefault();
                if (cust != null)
                {
                    cust.Prop_Desc = tblProperty.Prop_Desc;
                    cust.Prop_Type = tblProperty.Prop_Type;
                    cust.Prop_Stat = tblProperty.Prop_Stat;
                    cust.BedRoom   = tblProperty.BedRoom;
                    cust.BathRoom  = tblProperty.BathRoom;
                    cust.Garage    = tblProperty.Garage;
                    cust.Price     = tblProperty.Price;
                    cust.Cities    = tblProperty.Cities;
                    cust.Address   = tblProperty.Address;

                    var res = db.SaveChanges();
                }
                else
                {
                    return(NotFound());
                }
            }

            return(Ok());
        }
Beispiel #3
0
        public IHttpActionResult PosttblProperty(tblProperty tblProperty)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.tblProperties.Add(tblProperty);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (tblPropertyExists(tblProperty.Prop_id))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = tblProperty.Prop_id }, tblProperty));
        }
Beispiel #4
0
 /// <summary>
 /// Saves all changes to the ViewModel
 /// </summary>
 private void SaveLevel(TD.ObservableItemCollection <PropertyModel> treeLevel, EDBEntities eDB)
 {
     try
     {
         if (treeLevel != null)
         {
             foreach (var propertyItem in treeLevel)
             {
                 if (propertyItem.IsNew)
                 {
                     tblProperty NewRec = new tblProperty();
                     var         Rec    = eDB.tblProperties.Add(NewRec);
                     Rec.ID              = propertyItem.ID;
                     Rec.Parent_ID       = propertyItem.Parent_ID;
                     Rec.PropertyName    = propertyItem.PropertyName;
                     Rec.Description     = propertyItem.Description;
                     Rec.Project_ID      = propertyItem.Project_ID;
                     Rec.PropertyType_ID = propertyItem.PropertyType_ID;
                     Rec.Aspect          = propertyItem.Aspect;
                     Rec.Attribute1      = propertyItem.Attribute1;
                     Rec.Attribute2      = propertyItem.Attribute2;
                     Rec.Attribute3      = propertyItem.Attribute3;
                     Rec.Value           = propertyItem.Value;
                     propertyItem.IsNew  = false;
                 }
                 if (propertyItem.IsChanged)
                 {
                     tblProperty Rec = eDB.tblProperties.Where(o => o.ID == propertyItem.ID).FirstOrDefault();
                     Rec.Parent_ID          = propertyItem.Parent_ID;
                     Rec.PropertyName       = propertyItem.PropertyName;
                     Rec.Description        = propertyItem.Description;
                     Rec.Project_ID         = propertyItem.Project_ID;
                     Rec.PropertyType_ID    = propertyItem.PropertyType_ID;
                     Rec.Aspect             = propertyItem.Aspect;
                     Rec.Attribute1         = propertyItem.Attribute1;
                     Rec.Attribute2         = propertyItem.Attribute2;
                     Rec.Attribute3         = propertyItem.Attribute3;
                     Rec.Value              = propertyItem.Value;
                     propertyItem.IsChanged = false;
                 }
                 // DeleteRecursive call to add/Update children
                 if (propertyItem.ChildProperties != null)
                 {
                     SaveLevel(propertyItem.ChildProperties, eDB);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         RadWindow.Alert(new DialogParameters()
         {
             Header  = "Error",
             Content = "Fault while adding/updating to database:\n" + ex.Message
         });
     }
 }
Beispiel #5
0
        public IHttpActionResult GettblProperty(int id)
        {
            tblProperty tblProperty = db.tblProperties.Find(id);

            if (tblProperty == null)
            {
                return(NotFound());
            }

            return(Ok(tblProperty));
        }
Beispiel #6
0
        public IHttpActionResult DeletetblProperty(int id)
        {
            tblProperty tblProperty = db.tblProperties.Find(id);

            if (tblProperty == null)
            {
                return(NotFound());
            }

            db.tblProperties.Remove(tblProperty);
            db.SaveChanges();

            return(Ok(tblProperty));
        }
 protected void dgvGridView_RowCommand(object sender, System.Web.UI.WebControls.GridViewCommandEventArgs e)
 {
     if (!string.IsNullOrEmpty(e.CommandArgument.ToString()))
     {
         objCommon = new clsCommon();
         if (e.CommandName == "IsShowInSearch")
         {
             objProperty = new tblProperty();
             if (objProperty.LoadByPrimaryKey(Convert.ToInt32(e.CommandArgument.ToString())))
             {
                 if (objProperty.AppIsShowInSearch == true)
                 {
                     objProperty.AppIsShowInSearch = false;
                 }
                 else if (objProperty.AppIsShowInSearch == false)
                 {
                     objProperty.AppIsShowInSearch = true;
                 }
                 objProperty.Save();
                 LoadDataGrid(false, false, "", "");
             }
         }
         else if (e.CommandName == "Up")
         {
             LinkButton  inkButton = (LinkButton)e.CommandSource;
             GridViewRow drCurrent = (GridViewRow)inkButton.Parent.Parent;
             if (drCurrent.RowIndex > 0)
             {
                 GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex - 1];
                 objCommon.SetDisplayOrder("tblProperty", tblProperty.ColumnNames.AppPropertyID, tblProperty.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]);
                 LoadDataGrid(false, false);
                 objCommon = null;
             }
         }
         else if (e.CommandName == "Down")
         {
             LinkButton  lnkButton = (LinkButton)e.CommandSource;
             GridViewRow drCurrent = (GridViewRow)lnkButton.Parent.Parent;
             if (drCurrent.RowIndex < dgvGridView.Rows.Count - 1)
             {
                 GridViewRow drUp = dgvGridView.Rows[drCurrent.RowIndex + 1];
                 objCommon.SetDisplayOrder("tblProperty", tblProperty.ColumnNames.AppPropertyID, tblProperty.ColumnNames.AppDisplayOrder, (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[0], (int)dgvGridView.DataKeys[drCurrent.RowIndex].Values[1], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[0], (int)dgvGridView.DataKeys[drUp.RowIndex].Values[1]);
                 LoadDataGrid(false, false);
                 objCommon = null;
             }
             objProperty = null;
         }
     }
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            SetUpPageContent(ref metaDescription, ref metaKeywords);
            objCommon        = new clsCommon();
            hdnProduct.Value = objCommon.GetParameterFromUrl(Enums.Enums_URLParameterType.ByNumber, "1");
            lblLiteral.Text  = " / " + hdnProduct.Value;
            this.Page.Title  = hdnCategory.Value;
            objCommon        = null;

            tblProperty objProperty = new tblProperty();
            RepProperty.DataSource = objProperty.LoadProductWiseProperty(hdnProduct.Value);
            RepProperty.DataBind();
            objProperty = null;

            tblProduct objProduct = new tblProduct();
            decimal    iPrice     = objProduct.GetProductNameWiseMaxPrice(hdnProduct.Value);
            objProduct        = null;
            iPrice            = Math.Round(Convert.ToDecimal(HttpContext.Current.Session[appFunctions.Session.CurrencyInRupee.ToString()].ToString()) * iPrice, 0) + 100;
            hdnMaxPrice.Value = iPrice.ToString();

            dtColor.DataSource = null;
            dtColor.DataBind();
            tblColor objColor = new tblColor();
            objColor.Where.AppIsActive.Value = true;
            objColor.Query.AddOrderBy(tblColor.ColumnNames.AppDisplayOrder, MyGeneration.dOOdads.WhereParameter.Dir.ASC);
            objColor.Query.Load();
            if (objColor.RowCount > 0)
            {
                if (objColor.RowCount == 1)
                {
                    if (objColor.s_AppIsDefault != "")
                    {
                        if (objColor.AppIsDefault)
                        {
                            Seccolor.Style.Add("display", "none");
                        }
                    }
                }
                dtColor.DataSource = objColor.DefaultView.Table;;
                dtColor.DataBind();
            }
            objColor         = null;
            hdnOrderBy.Value = " vw_SerachProduct.appProductId Desc";
        }
    }
    private void LoadDataGrid(bool IsResetPageIndex, bool IsSort, string strFieldName = "", string strFieldValue = "")
    {
        objProperty = new tblProperty();

        objDataTable = objProperty.LoadGridData(ddlFields.SelectedValue, txtSearch.Text.Trim());

        //'Reset PageIndex of gridviews
        if (IsResetPageIndex)
        {
            if (dgvGridView.PageCount > 0)
            {
                dgvGridView.PageIndex = 0;
            }
        }

        dgvGridView.DataSource = null;
        dgvGridView.DataBind();
        lblCount.Text        = 0.ToString();
        hdnSelectedIDs.Value = "";

        //'Check for data into datatable
        if (objDataTable.Rows.Count <= 0)
        {
            DInfo.ShowMessage("No data found", Enums.MessageType.Information);
            return;
        }
        else
        {
            if (ddlPerPage.SelectedItem.Text.ToLower() == "all")
            {
                dgvGridView.AllowPaging = false;
            }
            else
            {
                dgvGridView.AllowPaging = true;
                dgvGridView.PageSize    = Convert.ToInt32(ddlPerPage.SelectedItem.Text);
            }

            lblCount.Text          = objDataTable.Rows.Count.ToString();
            objDataTable           = SortDatatable(objDataTable, ViewState["SortColumn"].ToString(), (appFunctions.Enum_SortOrderBy)ViewState["SortOrder"], IsSort);
            dgvGridView.DataSource = objDataTable;
            dgvGridView.DataBind();
        }

        objProperty = null;
    }
Beispiel #10
0
        public int CreateProperty(Property property)
        {
            using (var scope = new TransactionScope())
            {
                var newproperty = new tblProperty
                {
                    Description = property.Description,
                    Price       = property.Price,
                    IsSold      = property.IsSold
                };

                _unitOfWork.PropertyRepository.Insert(newproperty);
                _unitOfWork.Save();
                scope.Complete();
                return(newproperty.PropertyID);
            }
        }
    private bool Delete(int intPKID)
    {
        bool retval = false;

        objProperty = new tblProperty();

        var _with1 = objProperty;

        if (_with1.LoadByPrimaryKey(intPKID))
        {
            _with1.MarkAsDeleted();
            _with1.Save();
        }

        retval      = true;
        objProperty = null;
        return(retval);
    }
Beispiel #12
0
 public static int PropertyUpdation(tblProperty property)
 {
     try
     {
         using (var objdata = new HavanadataclassesDataContext())
         {
             property.Crdt     = DateTime.Now;
             property.Updt     = DateTime.Now;
             property.IsActive = true;
             objdata.tblProperties.InsertOnSubmit(property);
             objdata.SubmitChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #13
0
 /// <summary>
 /// code to delete properties....
 /// </summary>
 /// <param name="ids"></param>
 /// <returns></returns>
 public static int DeletePropertiesDetails(int ids)
 {
     try
     {
         using (var objdata = new HavanadataclassesDataContext())
         {
             tblProperty property = objdata.tblProperties.Where(x => x.Id == ids).FirstOrDefault();
             if (property != null)
             {
                 property.IsActive = false;
             }
             objdata.SubmitChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #14
0
 /// <summary>
 /// code for updation of property details
 /// </summary>
 /// <param name="ids"></param>
 /// <param name="price"></param>
 /// <param name="_for"></param>
 /// <returns></returns>
 public static int updatePropertyDetails(int ids, long price, string _for)
 {
     try
     {
         using (var objdata = new HavanadataclassesDataContext())
         {
             tblProperty property = objdata.tblProperties.Where(x => x.Id == ids).FirstOrDefault();
             if (property != null)
             {
                 property.Price = Convert.ToInt64(price);
                 property.For   = _for;
             }
             objdata.SubmitChanges();
             return(1);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Beispiel #15
0
 private void SetValuesToControls()
 {
     if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
     {
         objProperty = new tblProperty();
         if (objProperty.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value)))
         {
             txtPropertyName.Text      = objProperty.AppPropertyName;
             txtDisplayName.Text       = objProperty.AppDisplayName;
             txtDescription.Text       = objProperty.AppDescription;
             chkIsPredefine.Checked    = objProperty.AppIsPredefine;
             ChkIsShowInSearch.Checked = objProperty.AppIsShowInSearch;
             if (!objProperty.AppIsPredefine)
             {
                 Page.ClientScript.RegisterStartupScript(this.GetType(), "CallMyFunction", "SomeShoW()", true);
             }
             LoadAllData();
         }
         objProperty = null;
     }
 }
Beispiel #16
0
    private bool SaveData()
    {
        objCommon = new clsCommon();
        if (objCommon.IsRecordExists("tblProperty", tblProperty.ColumnNames.AppPropertyName, tblProperty.ColumnNames.AppPropertyID, txtPropertyName.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage("Property Name alredy exits.", Enums.MessageType.Error);
            return(false);
        }
        if (objCommon.IsRecordExists("tblProperty", tblProperty.ColumnNames.AppDisplayName, tblProperty.ColumnNames.AppPropertyID, txtDisplayName.Text, hdnPKID.Value))
        {
            DInfo.ShowMessage("Display Name alredy exits.", Enums.MessageType.Error);
            return(false);
        }
        objProperty = new tblProperty();
        if (!string.IsNullOrEmpty(hdnPKID.Value) && hdnPKID.Value != "")
        {
            objProperty.LoadByPrimaryKey(Convert.ToInt32(hdnPKID.Value));
        }
        else
        {
            objProperty.AddNew();
            objProperty.AppDisplayOrder = objCommon.GetNextDisplayOrder("tblProperty", tblProperty.ColumnNames.AppDisplayOrder);
            objProperty.s_AppCreatedBy  = Session[appFunctions.Session.UserID.ToString()].ToString();
            objProperty.AppCreatedDate  = DateTime.Now;


            // objBanner.AppDisplayOrder = objClsCommon.GetNextDisplayOrder("tblBanner", tblBanner.ColumnNames.AppDisplayOrder);
        }
        objProperty.AppPropertyName   = txtPropertyName.Text;
        objProperty.AppDisplayName    = txtDisplayName.Text;
        objProperty.AppDescription    = txtDescription.Text;
        objProperty.AppIsPredefine    = chkIsPredefine.Checked;
        objProperty.AppIsShowInSearch = ChkIsShowInSearch.Checked;
        objProperty.Save();
        intPkId     = objProperty.AppPropertyID;
        objProperty = null;
        objCommon   = null;
        return(true);
    }
Beispiel #17
0
        public ActionResult Create(PropertyVM mod)
        {
            if (ModelState.IsValid)
            {
                try
                {
                    if (mod.SocietyID <= 0)
                    {
                        tblSociety soc = new tblSociety
                        {
                            CityID  = mod.CityID,
                            Society = mod.OtherSociety,
                            Status  = true
                        };
                        db.tblSocieties.Add(soc);
                        db.SaveChanges();
                        mod.SocietyID = soc.SocietyID;
                    }
                    tblProperty tbl = new tblProperty
                    {
                        CityID        = mod.CityID,
                        Description   = mod.Description,
                        IsFeatured    = mod.IsFeatured,
                        LandArea      = mod.LandArea,
                        Price         = mod.Price,
                        PropertyTitle = mod.PropertyTitle,
                        Purpose       = mod.Purpose,
                        SocietyID     = mod.SocietyID,
                        Status        = "H",
                        TransDate     = DateTime.Now.AddHours(12),
                        TypeID        = mod.TypeID,
                        UOMID         = mod.UOMID,
                        UserID        = bl.GetUserID(System.Web.HttpContext.Current),
                        Block         = mod.Block,
                        ContactNo     = mod.ContactNo,
                        Estate        = mod.Estate,
                        IsDealer      = mod.IsDealer,
                        Owner         = mod.Owner,
                        PlotNo        = mod.PlotNo
                    };
                    db.tblProperties.Add(tbl);
                    db.SaveChanges();

                    var coun = Request.Files.Count;
                    for (int i = 0; i < coun; i++)
                    {
                        var file = Request.Files[i];
                        if (file != null && file.ContentLength > 0)
                        {
                            var      fileName = Path.GetExtension(file.FileName);
                            tblImage img      = new tblImage
                            {
                                PropertyID = tbl.PropertyID,
                                ImagePath  = fileName,
                                Status     = true
                            };
                            db.tblImages.Add(img);
                            db.SaveChanges();
                            var path = Path.Combine(Server.MapPath("~/Images/"), img.ImageID + fileName);
                            file.SaveAs(path);
                        }
                    }
                    return(RedirectToAction("Create"));
                }
                catch (Exception)
                {
                }
            }
            return(View(mod));
        }