Exemplo n.º 1
0
        void quanmin()
        {
            Waiting waiting = new Waiting();

            //点击BOOS
            waiting.BackClick(454, 406);
            Thread.Sleep(500);

            //
            //根据红点检测是否有挑战次数
            //


            //等待魔界界面(以前往挑战作为标识)
            waiting.SetFinder(Finders.Qianwantiaozhan).WaitShow(null, waiting.NewBackChecker(Finders.MainView));
            Thread.Sleep(500);

            //点击全民选项
            waiting.BackClick(192, 701);
            Thread.Sleep(500);

            //等待‘全民BOSS’界面
            waiting.SetFinder(Finders.Tiaozhan).WaitShow(null, waiting.BackChecker);
            Thread.Sleep(500);

            //点击最后一项挑战
            waiting.BackClick(425, 621);
            Thread.Sleep(500);

            //勾选自动复活
            waiting.SetFinder(Finders.Zidonfuhuo).WaitShow(null, waiting.BackChecker);
            waiting.BackClick(0, 0);

            //等待回到主界面..
        }
Exemplo n.º 2
0
        private void btnBangChamCongThoiVu_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Waiting.ShowWaitForm();
            if (!Class.App.IsFocusForm(typeof(frmChamCong_BangXepCa), this))
            {
                // kiem tra du lieu thang hien tai va tat waiting
                Class.BangXepCa bxc = new Class.BangXepCa();
                bxc.Month = DateTime.Now.Month;
                bxc.Year  = DateTime.Now.Year;
                DataTable dt = bxc.CT_TIMEKEEPER_TABLELIST_Get();
                if (dt.Rows.Count < 1)
                {
                    if (Waiting.IsSplashFormVisible)
                    {
                        Waiting.CloseWaitForm();
                    }
                }

                Class.S_Log.Insert("Chấm công", "Xem danh sách bảng xếp ca");
                frmChamCong_BangXepCa frm = new frmChamCong_BangXepCa();
                frm.MdiParent = this;
                frm.Show();
            }
            if (Waiting.IsSplashFormVisible)
            {
                Waiting.CloseWaitForm();
            }
        }
Exemplo n.º 3
0
        public Model()
        {
#if DEBUG
            // This is some test data to assist in the UI Designer
            Expecting.Add(new PmsAppointment()
            {
                ArrivalTime = "10:35am", PatientName = "Postlethwaite, Brian", PatientMobilePhone = "0423857505", ArrivalStatus = "Pending", AppointmentStartTime = "9:45am", PractitionerName = "Dr Nathan Pinskier"
            });
            Expecting.Add(new PmsAppointment()
            {
                ArrivalTime = "10:35am", PatientName = "Esler, Brett", PatientMobilePhone = "0423083847", ArrivalStatus = "Pending", AppointmentStartTime = "10:00am", PractitionerName = "Dr Nathan Pinskier"
            });
            Waiting.Add(new PmsAppointment()
            {
                ArrivalTime = "10:35am", PatientName = "Grieve, Grahame", PatientMobilePhone = "0423083847", ArrivalStatus = "Arrived", AppointmentStartTime = "10:00am", PractitionerName = "Dr Nathan Pinskier"
            });
            RoomMappings.Add(new DoctorRoomLabelMappings()
            {
                PractitionerFhirID  = "1",
                PractitionerName    = "Dr Nathan",
                LocationName        = "Room 1",
                LocationDescription = "Proceed through the main lobby and its the 3rd door on the right"
            });
#endif
        }
Exemplo n.º 4
0
        public bool ProcesarArchivo(string pathArchivo, DataGridView dgv, Label lbl)
        {
            this.waiting = new Waiting();
            this.waiting.Show();
            bool          resultado = false;
            List <Person> persons   = Funcion.LeerArchivo(pathArchivo, Tool);

            resultado      = Tool.CreateFolder(Valor.FolderFile);              //path carpeta archivos
            resultado      = Tool.CreateFolder(Valor.PathFolderFileEmpresa()); // path carpeta archivos empresa
            resultado      = Tool.CreateFolder(Valor.PathFolderImageQr());     // path carpeta qr empresa
            dgv.DataSource = Valor.GetDt();
            dgv.ClearSelection();
            if (dgv.Rows.Count == 0)
            {
                // MessageBox.Show("No existen datos para procesar", "INFORMACION DEL SISTEMA", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                //return true;
            }
            lbl.Text = "Numero de errores en el archivo : " + dgv.Rows.Count + Environment.NewLine + pathArchivo + Environment.NewLine +
                       "Insertando datos en Db" + Environment.NewLine + "Espere un momento, esto puede tardar unos segundos";

            string pathFileXlsx = Valor.PathFileXlsx();//path del archivo excel

            resultado = Funcion.CreateFileXlsx(persons, pathFileXlsx, Tool);
            if (resultado)
            {
                UploadPersonToApi(lbl, "INSERT");
            }

            return(resultado);
        }
Exemplo n.º 5
0
        private void Clubs_Shown(object sender, EventArgs e)
        {
            try
            {
                var cekanje = new Waiting();
                // upali čekanje
                cekanje.Show();
                // prikupi podatke od API
                // endpoint za mečeve
                ClubObjekt klub = api.GetClubObjekt(ClubName);

                Matches mec = api.GetMatches(ClubName);

                cekanje.Close();

                lbl_KlubNazivVrednost.Text = klub.name;
                lbl_NumPlayersValue.Text   = klub.members_count.ToString();

                lbl_FinishedCount.Text = mec.finished.Count.ToString();
                l_InProgress.Text      = mec.in_progress.Count.ToString();
                l_Registration.Text    = mec.registered.Count.ToString();

                FillGridWithData <Finished>(dgvFinished, mec.finished);
                FillGridWithData <InProgress>(dgvInProgress, mec.in_progress);
                FillGridWithData <Registered>(dgv_Registrations, mec.registered);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Desila se greška prilikom prikupljanja podataka o klubu. Provjerite naziv i pokušajte ponovo!" + ex.Message);
                this.Close();
            }
        }
Exemplo n.º 6
0
        static async Task <Tuple <TResponse, RequestInfo> > DoDelete <TResponse>(
            string relativeUrl,
            object jsonParams,
            OnError errorAction,
            bool showWaiting = true)
        {
            var request = new RequestInfo(relativeUrl)
            {
                ErrorAction = errorAction,
                HttpMethod  = "DELETE",
                JsonData    = jsonParams
            };

            try
            {
                if (showWaiting)
                {
                    await Waiting.Show();
                }

                var result = default(TResponse);
                if (await request.Send())
                {
                    result = await request.ExtractResponse <TResponse>();
                }
                return(Tuple.Create(result, request));
            }
            finally
            {
                if (showWaiting)
                {
                    await Waiting.Hide();
                }
            }
        }
Exemplo n.º 7
0
    void InitState(State s)
    {
        state = s;
        // stateが変わった時の初期化処理
        switch (s)
        {
        case State.waiting:
            waiting = new Waiting();
            waiting.Init();
            break;

        case State.playing:
            if (waiting != null)
            {
                waiting.Dispose();
            }
            WWWManager.Instance.Get(WWWManager.GET.PIECES, data =>
            {
                // TODO:全体の駒を扱うクラスを作って処理を渡す
                foreach (var piece in data)
                {
                    InitPieces(piece.Value);
                }
            });
            break;
        }
    }
Exemplo n.º 8
0
        public frmCn_adminWeb(string mac)
        {
            InitializeComponent();
            Waiting.ShowWaitForm();
            this.Text += " : " + mac;
            Class.CN_ADMIN cn = new Class.CN_ADMIN();
            if (!cn.isLogin())
            {
                cn.Connect(Class.CN_ADMIN.User, Class.CN_ADMIN.Passwors);
            }
            string        CustomerName = "";
            string        Address      = "";
            string        Ward         = "";
            string        modemID      = "";
            List <string> l            = new List <string>();

            if (cn.isLogin())
            {
                // thuc hien lay mac theo dinh dang
                mac = mac.Replace(".", "");
                mac = mac.Replace(".", "");
                // khoi thao mac theo dinh dang
                mac = mac.Insert(2, ":");
                mac = mac.Insert(5, ":");
                mac = mac.Insert(8, ":");
                mac = mac.Insert(11, ":");
                mac = mac.Insert(14, ":");

                // l = cn.Device_Search(mac, "2", out CustomerName, out Address, out Ward);
                cn.Device_Search(mac, "2", out CustomerName, out Address, out Ward, out modemID);
            }
            webBrowser.Navigate("http://101.99.28.133/cn-admin/lib/rrd_hf.php?modemID=" + modemID);
            Waiting.CloseWaitForm();
        }
Exemplo n.º 9
0
        private void btnView_Click(object sender, EventArgs e)
        {
            if (dateTo.DateTime < dateFrom.DateTime)
            {
                MessageBox.Show("Ngày tháng nhập không hợp lệ !.");
                return;
            }
            dtxp.Clear();
            btnExportExcelTemplate.Enabled        = false;
            btnExportExcelTemplateByGroup.Enabled = false;
            Waiting.ShowWaitForm();
            colTimeStr.Visible        = true;
            colTimeIn.Visible         = false;
            colTimeOut.Visible        = false;
            colDepartmentName.Visible = true;
            colGroupName.Visible      = true;
            colDayStr.Visible         = false;
            colDateStr.Visible        = false;
            colIndex.Visible          = false;
            colMachineNumber.Visible  = true;
            Class.ChamCong_CheckInOut cc = new Class.ChamCong_CheckInOut();
            cc.FromDay = dateFrom.DateTime;
            cc.ToDay   = dateTo.DateTime;
            DataTable dt = cc.CHECKINOUT_GetByDate();

            gridItem.DataSource = dt;
            Waiting.CloseWaitForm();
        }
Exemplo n.º 10
0
 private void btnTongHopXem_Click(object sender, EventArgs e)
 {
     if (dateTHTo.DateTime < dateTHFrom.DateTime)
     {
         MessageBox.Show("Ngày tháng nhập không hợp lệ !.");
         return;
     }
     Waiting.ShowWaitForm();
     Waiting.SetWaitFormDescription("Đang khởi tạo yêu cầu..");
     colIndex.Visible          = true;
     colDayStr.Visible         = true;
     colDateStr.Visible        = true;
     colTimeOut.Visible        = true;
     colTimeIn.Visible         = true;
     colDepartmentName.Visible = true;
     colGroupName.Visible      = true;
     colTimeStr.Visible        = false;
     colMachineNumber.Visible  = false;
     Class.ChamCong_CheckInOut cc = new Class.ChamCong_CheckInOut();
     cc.FromDay      = dateTHFrom.DateTime;
     cc.ToDay        = dateTHTo.DateTime;
     cc.TimeBeginIn  = timeBeginIn.Time;
     cc.TimeEndIn    = timeEndIn.Time;
     cc.TimeBeginOut = timeBeginOut.Time;
     cc.TimeEndOut   = timeEndOut.Time;
     dtxp            = cc.CHECKINOUT_GetByDateAll_Report();
     Waiting.SetWaitFormDescription("Khởi tạo dữ liệu hoàng tất..");
     gridItem.DataSource = dtxp;
     if (dtxp.Rows.Count > 0)
     {
         btnExportExcelTemplate.Enabled        = true;
         btnExportExcelTemplateByGroup.Enabled = true;
     }
     Waiting.CloseWaitForm();
 }
Exemplo n.º 11
0
    private void Start()
    {
        isOutside = false;

        slide   = GetComponent <SliderJoint2D>();
        waiting = new Waiting(StartWait);
        storageVoid.InstMemory("float", 1, 3);


        storageVoid["0", "0"] = (p) =>
        {
            slide.anchor = new Vector2(0, anchorBrian);
            return(speedOther);
        };
        storageVoid["0", "1"] = (p) =>
        {
            slide.anchor = new Vector2(0, anchorEva);
            return(speedEva);
        };
        storageVoid["0", "2"] = (p) =>
        {
            slide.anchor = new Vector2(0, anchorZak);
            return(speedOther);
        };
    }
Exemplo n.º 12
0
        public async Task <IActionResult> AddToWaitlist(string ISBN)
        {
            //check if waitlist exists; if not: create a new one for the associated book

            var bookWaitlist = GetWaitlist(ISBN);

            if (bookWaitlist == null)
            {
                var new_waitlist = new Waitlist(ISBN);
                _context.Waitlists.Add(new_waitlist);
                _context.SaveChanges();
            }
            bookWaitlist = GetWaitlist(ISBN);

            var userEmail   = HttpContext.Items["Email"] as string;
            var userId      = _context.Users.FirstAsync(x => x.Email == userEmail).Id;
            var checkExists =
                _context.WaitingPeople.FirstOrDefault(
                    x => x.UserUserID == userId && x.WaitlistListID == bookWaitlist.ListID);

            if (checkExists == null)
            {
                var waitingList = new Waiting(userId, bookWaitlist.ListID ?? default(int));
                _context.WaitingPeople.Add(waitingList);
                _context.SaveChanges();
            }


            return(Ok());
        }
Exemplo n.º 13
0
        private void CreateTestDataForDebug()
        {
#if DEBUG
            // This is some test data to assist in the UI Designer
            Expecting.Add(new PmsAppointment()
            {
                PatientName = "Postlethwaite, Brian", PatientMobilePhone = "0423857505", ArrivalStatus = Hl7.Fhir.Model.Appointment.AppointmentStatus.Pending, AppointmentStartTime = DateTime.Parse("9:45am"), PractitionerName = "Dr Nathan Pinskier"
            });
            Expecting.Add(new PmsAppointment()
            {
                PatientName = "Esler, Brett", PatientMobilePhone = "0423083847", ArrivalStatus = Hl7.Fhir.Model.Appointment.AppointmentStatus.Pending, AppointmentStartTime = DateTime.Parse("10:00am"), PractitionerName = "Dr Nathan Pinskier"
            });
            Waiting.Add(new PmsAppointment()
            {
                PatientName = "Grieve, Grahame", PatientMobilePhone = "0423083847", ArrivalStatus = Hl7.Fhir.Model.Appointment.AppointmentStatus.Arrived, AppointmentStartTime = DateTime.Parse("10:00am"), PractitionerName = "Dr Nathan Pinskier"
            });
            RoomMappings.Add(new DoctorRoomLabelMapping()
            {
                PractitionerFhirID  = "1",
                PractitionerName    = "Dr Nathan",
                LocationName        = "Room 1",
                LocationDescription = "Proceed through the main lobby and its the 3rd door on the right"
            });
            RoomMappings.Add(new DoctorRoomLabelMapping()
            {
                PractitionerFhirID  = "1",
                PractitionerName    = "Dr Smith",
                LocationName        = "Room 2",
                LocationDescription = "Proceed through the main lobby and its the 2nd door on the right"
            });
#endif
        }
Exemplo n.º 14
0
        public void mem(int n)
        {
            //Flyweight atminties matavimas
            FlyweightFactory f = new FlyweightFactory();

            State[] s  = new State[n];
            State[] s1 = new State[n];
            GC.Collect();
            GC.Collect();
            GC.Collect();
            long kbBefore = GC.GetTotalMemory(true);

            for (int i = 0; i < n; i++)
            {
                s[i] = f.GetFlyweight('W');
            }
            long kbAfter1 = GC.GetTotalMemory(false);
            long kbAfter2 = GC.GetTotalMemory(true);

            System.Diagnostics.Debug.WriteLine("Flyweight: memory usage with flyweight: n = {0}, {1}", n, kbAfter2 - kbBefore);
            GC.Collect();
            GC.Collect();
            GC.Collect();
            kbBefore = GC.GetTotalMemory(true);
            for (int i = 0; i < n; i++)
            {
                s1[i] = new Waiting();
            }
            kbAfter1 = GC.GetTotalMemory(false);
            kbAfter2 = GC.GetTotalMemory(true);
            System.Diagnostics.Debug.WriteLine("Flyweight: memory usage without flyweight: n = {0}, {1}", n, kbAfter2 - kbBefore);
        }
Exemplo n.º 15
0
        public void EchoMessage()
        {
            int port = 41717;

            using (var server = new EchoServer())
            {
                server.Start(port);

                using (var client = new EchoClient())
                {
                    var    sendMessage    = "abc";
                    string receiveMessage = null;

                    client.Connect(IPAddress.Loopback, port);
                    client.PacketReceived += reader =>
                    {
                        reader.Reset();
                        reader.Read <ushort>();
                        receiveMessage = reader.ReadString();
                    };
                    ClientToServer.Rpc.RequestEcho(client, sendMessage);
                    client.FlushPackets();

                    Waiting.Until(() => receiveMessage != null);

                    receiveMessage.Should().Be(sendMessage);
                }
            }
        }
Exemplo n.º 16
0
        public ActionResult DeleteConfirmed(int id)
        {
            Waiting waiting = db.Waitings.Find(id);

            db.Waitings.Remove(waiting);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemplo n.º 17
0
 public frmSignalHistory(string mac, int t)
 {
     InitializeComponent();
     Waiting.ShowWaitForm();
     Waiting.SetWaitFormDescription("Đang tải lịch sử Modem .!");
     LoadList(mac, 0);
     Waiting.CloseWaitForm();
 }
Exemplo n.º 18
0
        /// <summary>
        /// Définit si l'animation de chargement soit s'afficher ou non
        /// </summary>
        /// <param name="panel">Panel dans lequel insérer l'animation de chargement, null si pas de chargement</param>
        public void SetLoading(Panel panel)
        {
            // débute le chargement
            if (panel != null && _pageLoaded == false)             // si on active le chargement
            {
                if (_waiting == null)
                {
                    _waiting = new Waiting();              // crée le control si pas encore fait
                }
                _waiting.Name     = "waiting";             // nom permettant de le supprimer plus facilement
                _waiting.Location = new Point(
                    (panel.Width - _waiting.Width) / 2,
                    (panel.Height - _waiting.Height) / 2
                    );

                panel.Controls.Add(_waiting);                             // ajout l'animation de chargement au panel

                _page.FlatDataGridView.DataSourceChanged(DataAddedToDgv); // méthode de callback à appeler lorsque les données sont chargées (fin du chargement)
                _page.FlatDataGridView.Visible = false;                   // désactive la dgv durant le chargement
            }
            // fin du chargement et présence de donnée
            else if (_page.FlatDataGridView.Rows.Count != 0 && _pageLoaded)
            {
                _waiting.Dispose();                    // retire l'animation de chargement

                _page.FlatDataGridView.Visible = true; // affiche les données
            }
            // fin du chargement et absence de donnée
            else if (_page.FlatDataGridView.Rows.Count == 0 && _pageLoaded)
            {
                Control parent;

                if (!_waiting.IsDisposed)
                {
                    parent = _waiting.Parent;
                    _waiting.Dispose();

                    _labelNoItem = new FlatLabel()
                    {
                        ForeColor = Theme.BackLight,
                        AutoSize  = true,
                        Font      = new Font(Theme.Font.FontFamily, 24, FontStyle.Bold),
                        Text      = @"Aucune tâche à afficher"
                    };

                    parent.Controls.Add(_labelNoItem);
                }
                else
                {
                    parent = _labelNoItem.Parent;
                }

                _labelNoItem.Left = (parent.Width - _labelNoItem.Width) / 2;
                _labelNoItem.Top  = (parent.Height - _labelNoItem.Height) / 2;
            }
        }
        private void btnAddHD_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Waiting.ShowWaitForm();
            Waiting.SetWaitFormDescription("Đang khởi tạo hợp đồng mới..");
            frmDanhSachHopDong_Season_Update frm = new frmDanhSachHopDong_Season_Update(true, "Thêm Hợp Đồng Thời vụ", "HĐ", null, "frmDanhSachHopDong");

            frm.Owner = this;
            Waiting.CloseWaitForm();
            frm.ShowDialog();
        }
Exemplo n.º 20
0
 public frmSignalChart(string mac, int t)
 {
     InitializeComponent();
     Waiting.ShowWaitForm();
     Waiting.SetWaitFormDescription("Đang tải biểu đồ .!");
     LoadChart(mac, t);
     this.Text = "Chart For Device " + mac;
     Waiting.CloseWaitForm();
     Mac = mac;
 }
Exemplo n.º 21
0
 public ActionResult Edit(Waiting waiting)
 {
     if (ModelState.IsValid)
     {
         db.Entry(waiting).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(waiting));
 }
Exemplo n.º 22
0
        private void btnLoadAll_Click(object sender, EventArgs e)
        {
            Waiting.ShowWaitForm();
            Waiting.SetWaitFormDescription("Đang tải lịch sử Card.!");
            Class.SolarWinds_Get clssl = new Class.SolarWinds_Get();
            DataTable            dt    = clssl.NW_InterfaceLog_GetList();

            gridItem.DataSource = dt;
            Waiting.CloseWaitForm();
        }
Exemplo n.º 23
0
 private void WaitingTimer_Tick(object sender, EventArgs e)
 {
     compteur++;
     if (compteur >= 5)
     {
         WaitingTimer.Stop();
         Waiting.Hide();
         timer1.Start();
     }
 }
Exemplo n.º 24
0
 public ActionResult Edit([Bind(Include = "WaitingId,ExtraTimePerWait,CostPerWait")] Waiting waiting)
 {
     if (ModelState.IsValid)
     {
         db.Entry(waiting).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(waiting));
 }
Exemplo n.º 25
0
        public async Task <IActionResult> Enter(int id)
        {
            Waiting waiting = await waitingRepository.Get(id).ConfigureAwait(true);

            waiting.EnteredDate = DateTime.Now;
            waitingRepository.Edit(waiting);
            await unitOfWork.CompleteAsync().ConfigureAwait(true);

            return(Ok(mapper.Map <WaitingForGetDTO>(await waitingRepository.Get(id).ConfigureAwait(true))));
        }
Exemplo n.º 26
0
        void mojie()
        {
            Waiting waiting = new Waiting();

            //点击BOOS
            waiting.BackClick(454, 406);
            Thread.Sleep(500);

            //等待前往挑战
            waiting.SetFinder(Finders.Qianwantiaozhan).WaitShow(null, waiting.NewBackChecker(Finders.MainView));
            Thread.Sleep(500);

            //点击十倍爆率
            this.dm.Click(433, 188);
            Thread.Sleep(500);

            //点击前往挑战
            waiting.BackClickFoundPoint();
            Thread.Sleep(500);

            //等待进入
            waiting.SetFinder(Finders.Zidonzhandou).WaitShow(null, waiting.BackChecker);
            Thread.Sleep(500);

            //点击自动战斗
            this.dm.ClickFoundPoint();
            Thread.Sleep(5000);

            DateTime startDatetime = DateTime.Now;

            do
            {
                //等待恢复成 ‘自动战斗’
                waiting.SetFinder(Finders.Zidonzhandou).WaitShow();
                Thread.Sleep(500);

                TimeSpan timeSpan = DateTime.Now - startDatetime;
                if (timeSpan.Hours >= 1)
                {
                    return;
                }
                else
                {
                    Controller.ViewPrintLine("检测到当前计时未满足1小时。与起始时间的分钟差:{0}", timeSpan.Minutes);
                }

                //点击随机传送
                waiting.BackClick(432, 611);
                Thread.Sleep(500);

                //点击自动战斗
                this.dm.Click(458, 575);
                Thread.Sleep(5000);
            } while (true);
        }
Exemplo n.º 27
0
        public ActionResult Create([Bind(Include = "WaitingId,ExtraTimePerWait,CostPerWait")] Waiting waiting)
        {
            if (ModelState.IsValid)
            {
                db.Waitings.Add(waiting);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(waiting));
        }
Exemplo n.º 28
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
 }
Exemplo n.º 29
0
        // Todo: ask default value of database;
        public ActionResult Create(Waiting waiting)
        {
            if (ModelState.IsValid)
            {
                db.Waitings.Add(waiting);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(waiting));
        }
Exemplo n.º 30
0
 private void btnSystemHelp_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
 {
     Waiting.ShowWaitForm();
     if (!Class.App.IsFocusForm(typeof(frmTroGiup), this))
     {
         frmTroGiup frm = new frmTroGiup();
         frm.MdiParent = this;
         frm.Show();
     }
     Waiting.CloseWaitForm();
 }
Exemplo n.º 31
0
        public ActionResult SaveWaiting(WaitingVM model)
        {
            try
            {
                bool isFakeMobileNo = long.Parse(model.MobileNumber) == 0L;

                if (!string.IsNullOrEmpty(model.Email))
                {
                    model.Email = model.Email.Trim();
                }

                model.MobileNumber = model.MobileNumber.Trim();

                var customer = db.tabCustomers.Where(c => !isFakeMobileNo && c.PhoneNumbers.Any(cn => cn.PhoneNumbers.Contains(model.MobileNumber))).FirstOrDefault();

                if (customer != null)
                {
                    var waiting = new Waiting()
                    {
                        Covers = model.Covers,
                        CustomerId = customer.CustomerId,
                        WaitingDate = model.WaitDate,
                        Notes = model.Notes,
                        CreatedOn = DateTime.UtcNow
                    };

                    db.tabWaitings.Add(waiting);
                }
                else
                {
                    var cust = new Customers()
                    {
                        FirstName = model.FirstName,
                        LastName = model.LastName,
                        DateCreated = DateTime.UtcNow,
                        DateOfBirth = DateTime.UtcNow,
                        Address1 = "1",
                        Address2 = "2",
                        Anniversary = DateTime.UtcNow,
                    };

                    db.tabCustomers.Add(cust);

                    if (!string.IsNullOrEmpty(model.Email))
                    {
                        var cemail = new CustomersEmails()
                        {
                            CustomerId = cust.CustomerId,
                            Email = model.Email,
                            EmailTypeId = 1
                        };
                        db.tabCustomersEmails.Add(cemail);
                    }

                    var cphone = new CustomersPhoneNumbers()
                    {
                        CustomerId = cust.CustomerId,
                        PhoneNumbers = model.MobileNumber,
                        PhoneTypeId = 1
                    };

                    db.tabCustomersPhoneNumbers.Add(cphone);

                    var waiting = new Waiting()
                    {
                        Covers = model.Covers,
                        CustomerId = cust.CustomerId,
                        WaitingDate = model.WaitDate,
                        Notes = model.Notes,
                        CreatedOn = DateTime.UtcNow
                    };

                    db.tabWaitings.Add(waiting);

                }

                db.SaveChanges();

                ClearWaitingCache();

                return Json(new
                {
                    Status = ResponseStatus.Success,
                    Message = "Waitlist updated successfully.",
                }, JsonRequestBehavior.AllowGet);
            }
            catch (Exception)
            {
                return Json(new
                {
                    Status = ResponseStatus.Fail,
                    Message = "Failed to add waitlist booking, please try later..."
                }, JsonRequestBehavior.AllowGet);
            }
        }