Exemple #1
0
        public async Task <string> PostToServerDailyVOD(Com.DailyVOD mDailyVOD)
        {
            try
            {
                using (var httpClient = new HttpClient())
                {
                    using (var form = new MultipartFormDataContent())
                    {
                        StringContent contentBody = new StringContent(JsonConvert.SerializeObject(mDailyVOD));
                        form.Add(contentBody, "Object");

                        HttpResponseMessage response = await httpClient.PostAsync(BaseAddress + "fitness/VOD/PostDailyVOD", form);

                        if (response.StatusCode == System.Net.HttpStatusCode.OK)
                        {
                            MessageBox.Show("انجام شد");
                            return("Ok");
                        }
                        else
                        {
                            MessageBox.Show("مشکل در ارسال پست");

                            return("Error");
                        }
                    }
                }
            }
            catch (Exception eeee)
            {
                Console.WriteLine(eeee.Message);
                MessageBox.Show("مشکل در ارسال پست");
                MessageBox.Show(eeee.Message);
                return("Error");
            }
        }
Exemple #2
0
        private async void button1_Click(object sender, EventArgs e)
        {
            DataGridViewRow row                = dataGridView1.Rows[dataGridView1.CurrentCell.RowIndex];
            string          SelectedVIDsrt     = row.Cells[0].Value.ToString();
            int             SelectedVID        = Int32.Parse(SelectedVIDsrt);
            string          SelectedVIDNamesrt = row.Cells[1].Value.ToString();

            Com.DailyVOD dailyVOD = new Com.DailyVOD()
            {
                Date    = dateTimePicker1.Value.Date,
                VID     = SelectedVID,
                VODName = SelectedVIDNamesrt
            };

            var strRes = await PostToServerDailyVOD(dailyVOD);
        }
Exemple #3
0
        public static int AddDailyVOD(Com.DailyVOD mDailyVOD)
        {
            try
            {
                using (var ent = DB.Entity)
                {
                    ent.DailyVODs.Add(mDailyVOD);
                    ent.SaveChanges();

                    return(mDailyVOD.DVID);
                }
            }
            catch (Exception e)
            {
                Log.DoLog(Com.Common.Action.AddDailyVOD, "", -100, e.Message);
                return(-100);
            }
        }
Exemple #4
0
        public static int AddDailyVOD(Com.DailyVOD mDailyVOD)
        {
            try
            {
                using (var ent = DB.Entity)
                {
                    ent.DailyVODs.Add(mDailyVOD);
                    ent.SaveChanges();

                    return(mDailyVOD.DVID);
                }
            }
            catch (Exception e)
            {
                new System.Threading.Thread(delegate()
                {
                    Log.DoLog(Com.Common.Action.AddUserBought, mDailyVOD.VID.ToString(), -100, e.Message);
                });
                return(-100);
            }
        }
Exemple #5
0
        public static bool DeleteDailyVOD(int DVID)
        {
            try
            {
                using (var ent = DB.Entity)
                {
                    Com.DailyVOD mDailyVOD = new Com.DailyVOD()
                    {
                        DVID = DVID
                    };
                    ent.DailyVODs.Attach(mDailyVOD);
                    ent.DailyVODs.Remove(mDailyVOD);
                    ent.SaveChanges();
                }

                return(true);
            }
            catch (Exception e)
            {
                Log.DoLog(Com.Common.Action.DeleteVOD, DVID.ToString(), -100, e.Message);
                return(false);
            }
        }