public Object GetCity([FromBody] PlaceInput pi)
        {
            CityGet daOP          = new CityGet();
            DataSet SelectedSlots = new DataSet();
            string  sJSONResponse = "";

            DataTable dt_Sessions = new DataTable();

            List <City> city = new List <City>();

            try
            {
                dt_Sessions = getdata(string.Format("select city,CityName from city", ""));

                for (int i = 0; i < dt_Sessions.Rows.Count; i++)
                {
                    City stt = new City {
                        cityId = dt_Sessions.Rows[i]["city"].ToString(), CityName = dt_Sessions.Rows[i]["CityName"].ToString()
                    };
                    city.Add(stt);
                }

                daOP.status   = "success";
                daOP.value    = city;
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }
            catch (Exception ec)
            {
                daOP.status   = "fail";
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }


            return(sJSONResponse);
        }
        public Object CityPost([FromBody] PlaceInput pi)
        {
            string     sJSONResponse  = "";
            DataTable  dt_AppType     = new DataTable();
            string     ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
            int        a             = 0;
            string     country_Query = "";
            PlanOutPut Pcity         = new PlanOutPut();

            try
            {
                cnn.Open();
                country_Query = "insert into city(CityName,StatesId,IsDeleted,IsActive) values('" + pi.CityName + "'," + pi.StatesId + ",0,1) SELECT @@IDENTITY;";
                SqlCommand tm_cmd = new SqlCommand(country_Query, cnn);
                a            = Convert.ToInt32(tm_cmd.ExecuteScalar());
                Pcity.status = "Success";
            }
            catch (Exception ex)
            {
                Pcity.status = "Fail";
            }
            finally
            {
                cnn.Close();
            }

            sJSONResponse = JsonConvert.SerializeObject(Pcity);

            return(sJSONResponse);
        }
        public Object GetState([FromBody] PlaceInput pi)
        {
            StateGet daOP          = new StateGet();
            DataSet  SelectedSlots = new DataSet();
            string   sJSONResponse = "";

            DataTable dt_Sessions = new DataTable();

            List <State> state = new List <State>();

            try
            {
                dt_Sessions = getdata(string.Format("select StatesId,StatesName from States", ""));

                for (int i = 0; i < dt_Sessions.Rows.Count; i++)
                {
                    State stt = new State {
                        StatesId = dt_Sessions.Rows[i]["StatesId"].ToString(), StatesName = dt_Sessions.Rows[i]["StatesName"].ToString()
                    };
                    state.Add(stt);
                }

                daOP.status   = "success";
                daOP.value    = state;
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }
            catch (Exception ec)
            {
                daOP.status   = "fail";
                sJSONResponse = JsonConvert.SerializeObject(daOP);
            }


            return(sJSONResponse);
        }
Exemplo n.º 4
0
        private void LoadSchemeOfHall(int seatingCapacity, int placesInRowLimit)
        {
            RowInput.Clear();
            PlaceInput.Clear();
            int  X          = 6;
            int  Y          = 19;
            bool notEven    = false;
            int  leftPlaces = seatingCapacity % placesInRowLimit;

            if (leftPlaces != 0)
            {
                notEven     = true;
                buttonArray = new Button[(seatingCapacity / placesInRowLimit) + 1][];
            }
            else
            {
                buttonArray = new Button[seatingCapacity / placesInRowLimit][];
            }
            for (int i = 0; i < buttonArray.Length; i++)
            {
                buttonArray[i] = new Button[placesInRowLimit];
                if (i == buttonArray.Length - 1 && notEven)
                {
                    buttonArray[i] = new Button[leftPlaces];
                }
                for (int j = 0; j < buttonArray[i].Length; j++)
                {
                    buttonArray[i][j]             = new Button();
                    buttonArray[i][j].Size        = new Size(30, 30);
                    buttonArray[i][j].Name        = (i + 1).ToString();
                    buttonArray[i][j].Text        = (j + 1).ToString();
                    buttonArray[i][j].MouseClick += new MouseEventHandler(SelectedPlaceInHall);
                    if (i == buttonArray.Length - 1 && notEven)
                    {
                        X      += 35 * (placesInRowLimit - leftPlaces) / 2;
                        notEven = false;
                    }
                    buttonArray[i][j].Location = new Point(X, Y);
                    HallPlaces.Controls.Add(buttonArray[i][j]);
                    X += 35;
                }
                Label rowLabel = new Label();
                rowLabel.Size     = new Size(40, 30);
                rowLabel.Location = new Point(35 * buttonArray[0].Length, Y);
                rowLabel.Text     = "Ряд " + (i + 1) + " ";
                HallPlaces.Controls.Add(rowLabel);
                X  = 6;
                Y += 40;
            }
        }
        public Object CountryDelete([FromBody] PlaceInput pi)
        {
            string     sJSONResponse  = "";
            SqlCommand command        = cnn.CreateCommand();
            PlanOutPut Pcountry       = new PlanOutPut();
            string     ServerDateTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);

            try
            {
                cnn.Close();
                cnn.Open();
                SqlTransaction transaction;
                transaction         = cnn.BeginTransaction("SampleTransaction");
                command.Connection  = cnn;
                command.Transaction = transaction;
                try
                {
                    command.CommandText = "delete from Country where CountryId=" + pi.CountryId + " ";
                    command.ExecuteNonQuery();

                    transaction.Commit();
                    Pcountry.status = "Success";
                }
                catch (Exception ex)
                {
                    transaction.Rollback();
                }
                finally
                {
                }
            }
            catch (Exception ec)
            {
                Pcountry.status = "Fail";
            }

            sJSONResponse = JsonConvert.SerializeObject(Pcountry);

            return(sJSONResponse);
        }