Exemplo n.º 1
0
        public object getresult([FromBody] FullFlatInfo fullinfo)
        {
            List <FullFlatInfo> proplist = new List <FullFlatInfo>();

            proplist = sdal.SearchResult(fullinfo.landmark, fullinfo.cityname, fullinfo.property);
            string status = (proplist != null) ? Utils.success : Utils.failure;

            return(Utils.createResponce(status, proplist));
        }
Exemplo n.º 2
0
        public List <FullFlatInfo> SearchResult(string landmark, string cityname, string propertfor)
        {
            con.Open();

            MySqlTransaction transaction = con.BeginTransaction();


            try
            {
                MySqlCommand cmd = new MySqlCommand("spSearchFull", con, transaction);
                cmd.CommandType = System.Data.CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("sp_landmark", "%" + landmark + "%");
                cmd.Parameters.AddWithValue("sp_cityname", cityname);
                cmd.Parameters.AddWithValue("sp_propertyfor", propertfor);
                reader = cmd.ExecuteReader();

                List <FullFlatInfo> proplist = new List <FullFlatInfo>();
                while (reader.Read())
                {
                    FullFlatInfo fullinfo = new FullFlatInfo();
                    fullinfo.Cid = Convert.ToInt32(reader["Lid"]);
                    fullinfo.Fid = Convert.ToInt32(reader["Fid"]);

                    fullinfo.furnished   = reader["furnished"].ToString();
                    fullinfo.flattype    = reader["flattype"].ToString();
                    fullinfo.flatno      = Convert.ToInt32(reader["flatno"]);
                    fullinfo.property    = reader["propertyfor"].ToString();
                    fullinfo.price       = Convert.ToDouble(reader["price"]);
                    fullinfo.img1        = reader["img1"].ToString();
                    fullinfo.img2        = reader["img2"].ToString();
                    fullinfo.img3        = reader["img3"].ToString();
                    fullinfo.housearea   = reader["housearea"].ToString();
                    fullinfo.description = reader["description"].ToString();
                    fullinfo.cityname    = reader["cityname"].ToString();
                    fullinfo.landmark    = reader["landmark"].ToString();
                    fullinfo.fulladd     = reader["fulladd"].ToString();
                    fullinfo.premium     = reader["premium"].ToString();
                    fullinfo.flatfor     = reader["flatfor"].ToString();

                    proplist.Add(fullinfo);
                }
                reader.Close();
                transaction.Commit();
                con.Close();
                return(proplist);
            }
            catch
            {
                transaction.Rollback();
                con.Close();
                return(null);
            }
        }
Exemplo n.º 3
0
        public IHttpActionResult add()
        {
            try {
                FullFlatInfo info     = new FullFlatInfo();
                Address      add      = new Address();
                string       imgname1 = "";
                string       imgname2 = "";
                string       imgname3 = "";

                var httpRequest = HttpContext.Current.Request;
                var postedfile1 = httpRequest.Files["img1"];
                var postedfile2 = httpRequest.Files["img2"];
                var postedfile3 = httpRequest.Files["img3"];

                info.img1 = encrypter(postedfile1);
                info.img2 = encrypter(postedfile2);
                info.img3 = encrypter(postedfile3);


                var filepath1 = HttpContext.Current.Server.MapPath("~/images/" + info.img1 + Path.GetExtension(postedfile1.FileName));
                postedfile1.SaveAs(filepath1);
                var filepath2 = HttpContext.Current.Server.MapPath("~/images/" + info.img2 + Path.GetExtension(postedfile1.FileName));
                postedfile2.SaveAs(filepath2);
                var filepath3 = HttpContext.Current.Server.MapPath("~/images/" + info.img3 + Path.GetExtension(postedfile1.FileName));
                postedfile3.SaveAs(filepath3);


                int loginid = Convert.ToInt32(httpRequest.Form["loginid"]);
                info.flatno      = Convert.ToInt32(httpRequest.Form["flatno"]);
                info.furnished   = httpRequest.Form["furnished"];
                info.flattype    = httpRequest.Form["flattype"];
                info.flatfor     = httpRequest.Form["flatfor"];
                info.housearea   = httpRequest.Form["housearea"];
                info.description = httpRequest.Form["description"];
                info.property    = httpRequest.Form["property"];
                info.price       = Convert.ToDouble(httpRequest.Form["price"]);
                add.landmark     = httpRequest.Form["landmark"];
                add.cityname     = httpRequest.Form["cityname"];
                add.fulladd      = httpRequest.Form["fulladd"];

                int    inseted = fdal.addproperty(info, add, loginid);
                string status  = inseted == 1 ? Utils.success : Utils.failure;

                return(Ok(Utils.createResponce(status, inseted)));
            }
            catch
            {
                return(Ok(Utils.createResponce(Utils.failure, 0)));
            }
        }
Exemplo n.º 4
0
        public int addproperty(FullFlatInfo info, Address add, int loginid)
        {
            con.Open();
            MySqlTransaction transaction = con.BeginTransaction();

            try
            {
                // this Query insert data in address table
                string       queryformat = "insert into address(cityname,landmark,fulladd) values('{0}','{1}','{2}')";
                string       Query       = string.Format(queryformat, add.cityname, add.landmark, add.fulladd);
                MySqlCommand cmd         = new MySqlCommand(Query, con, transaction);
                int          RowAffected = cmd.ExecuteNonQuery();

                //this will give you auto increment id of address table
                long cityid = cmd.LastInsertedId;



                //below sql Query give Actual Lordid using Loginid
                string       queryformat5 = "select Lid from landlord where vid ='{0}'";
                string       Query5       = string.Format(queryformat5, loginid);
                MySqlCommand cmd5         = new MySqlCommand(Query5, con, transaction);
                int          Lid          = Convert.ToInt32((cmd5.ExecuteScalar()).ToString());


                //below mysql query insert sort property information
                string queryformat2 = "INSERT INTO flatinfo(Lid,Cityid,flatno,flatfor,furnished,flattype,img1,propertyfor,price,availability,Auth) ";
                queryformat2 += "VALUES('{0}','{1}','{2}','{3}','{4}','{5}','{6}','{7}','{8}','yes','yes')";
                string       Query2       = string.Format(queryformat2, Lid, cityid, info.flatno, info.flatfor, info.furnished, info.flattype, info.img1, info.property, info.price);
                MySqlCommand cmd2         = new MySqlCommand(Query2, con, transaction);
                int          RowAffected2 = cmd2.ExecuteNonQuery();

                //this below one line of code return auto incremented id
                long Fid = cmd2.LastInsertedId;



                //this mysql Query insert full property data in table fullflat info
                string queryformat3 = "INSERT INTO fullflatinfo(Fid,img2,img3,housearea,description) ";
                queryformat3 += "VALUES({0},'{1}','{2}','{3}','{4}')";
                string       Query3       = string.Format(queryformat3, Fid, info.img2, info.img3, info.housearea, info.description);
                MySqlCommand cmd3         = new MySqlCommand(Query3, con, transaction);
                int          RowAffected3 = cmd3.ExecuteNonQuery();



                transaction.Commit();



                con.Close();

                return(RowAffected3);
            }
            catch
            {
                transaction.Rollback();
                con.Close();
                return(0);
            }
        }