예제 #1
0
        private bool CheckPreConditions(int applicationId, string universityName, out Data.Application application)
        {
            application = appService.GetApplication(applicationId);
            var uni = uniService.GetUniversity(universityName);

            if (uni == null)
            {
                return(false);
            }
            if (application == null)
            {
                return(false);
            }
            if (appService.IsEnrolled(application.ApplicantId))
            {
                return(false);
            }
            if (application.UniversityId != uni.UniversityId)
            {
                return(false);
            }
            if (application.Firm.HasValue)
            {
                return(false);
            }
            return(true);
        }
예제 #2
0
        public string Create(Data.Application o)
        {
            //using (var scope = new TransactionScope())
            //{

            _unitOfWork.ApplicationRepo.Insert(o);
            _unitOfWork.Save();
            //    scope.Complete();
            return(o.Id);
            //}


            //_unitOfWork.ApplicationRepo.Insert(o);
        }
예제 #3
0
        private void btnPushApplication_Click(object sender, EventArgs e)
        {
            try
            {
                Data.Application p = new Data.Application();
                p.Applicant.FullName = "Ahmad " + name++.ToString();

                WebApiService was = new WebApiService();
                was.AddApplication(p);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #4
0
 // PUT api/product/5
 public HttpResponseMessage Put(Data.Application o)
 {
     if (ModelState.IsValid)
     {
         var result = _svc.Update(o);
         if (result == false)
         {
             return(Request.CreateResponse(HttpStatusCode.NotFound));
         }
         return(Request.CreateResponse(HttpStatusCode.OK));
     }
     else
     {
         return(Request.CreateResponse(HttpStatusCode.BadRequest));
     }
 }
예제 #5
0
        private void btnPushApplication_Click(object sender, EventArgs e)
        {
            try
            {
                Data.Application p = new Data.Application();
                p.Applicant.FullName = "Ahmad " + name++.ToString();

                WebApiService was = new WebApiService();
                was.AddApplication(p);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
예제 #6
0
파일: Check.cs 프로젝트: x360ce/x360ce
        public static void CreateDefaultApplication()
        {
            var db  = new Data.SecurityEntities();
            var app = db.Applications.FirstOrDefault(x => x.LoweredApplicationName == "/");

            if (app == null)
            {
                app = new Data.Application();
                app.ApplicationName        = "/";
                app.LoweredApplicationName = "/";
                app.ApplicationId          = new Guid("5985BB89-8015-42E3-9FE1-D7F9FD914EEC");
                app.Description            = "Default Application";
                db.Applications.AddObject(app);
                db.SaveChanges();
            }
        }
예제 #7
0
        protected virtual void InitializeRuntime()
        {
            if (StatisticsApplication.HasRuntime(this))
            {
                return;
            }

            lock (MobiHttpApplicationInitializeRuntimeLockObject)
            {
                //string name = HostingEnvironment.SiteName;
                if (StatisticsApplication.HasRuntime(this))
                {
                    return;
                }

                Data.Application application = MobiChat.Data.Application.CreateManager().Load(HostingEnvironment.SiteName);

                // SUMMARY: for testing from local
                if (application == null && HostingEnvironment.SiteName.Equals("MobiChat.Statistics"))
                {
                    application = MobiChat.Data.Application.CreateManager().Load(5);
                }
                if (application == null)
                {
                    //Log.Fatal(string.Format("Application {0} is not loaded.", HostingEnvironment.SiteName));
                    throw new InvalidOperationException(string.Format("No application with name '{0}' registered in database.", HostingEnvironment.SiteName));
                }

                this._baseApplication = new ApplicationBase(application);

                IRuntime runtime = this._baseApplication.ApplicationData.InstantiateRuntime();
                if (!runtime.Initialize(HostingEnvironment.SiteName))
                {
                    return;
                }

                StatisticsApplication.SetRuntime(this, runtime);

                Log.Debug(string.Format("Application {0} initialized!", HostingEnvironment.SiteName));
                this.InitializeApplication();
            }

            return;
        }
예제 #8
0
        // DELETE api/product/5
        public HttpResponseMessage Delete(string id)
        {
            Data.Application o = _svc.GetById(id);

            if (o == null)
            {
                return(Request.CreateResponse(HttpStatusCode.NotFound));
            }

            try
            {
                _svc.Delete(id);
            }
            catch (Exception exc)
            {
                return(Request.CreateResponse(HttpStatusCode.BadRequest));
            }

            return(Request.CreateResponse(HttpStatusCode.OK, o));
        }
예제 #9
0
        public bool Update(Data.Application o)
        {
            var success = false;

            if (o != null)
            {
                //using (var scope = new TransactionScope())
                //{
                var product = _unitOfWork.ApplicationRepo.GetByID(o.Id);
                if (product != null)
                {
                    //product = productEntity.ProductName;
                    _unitOfWork.ApplicationRepo.Update(product);
                    _unitOfWork.Save();
                    //      scope.Complete();
                    success = true;
                }
                //}
            }
            return(success);
        }
예제 #10
0
        public HttpResponseMessage Post(Data.Application o)
        {
            //if (ModelState.IsValid)
            {
                // this will set the ID for instance...
                string id = _svc.Create(o);

                /*
                 * 1. The client should send a POST request to /user to create the resource.
                 * 2. The server should then return a 201 CREATED response, with the URI of
                 * the resource in the Location header.
                 * */

                var response = Request.CreateResponse(HttpStatusCode.Created, o);

                string uri = Url.Link("DefaultApi", new { id = id });
                response.Headers.Location = new Uri(uri);
                return(response);
            }
            //else
            //{
            //    return Request.CreateResponse(HttpStatusCode.BadRequest);
            //}
        }
예제 #11
0
        void OnButtonClick(object sender, ButtonClickEventArgs e)
        {
            switch (e.Type)
            {
                case ButtonType.UnifiOthersPlanCompleted:
                    ShowForm(UserControlType.DocumentUpload);
                    break;
                case ButtonType.UnifiHyppTvCompleted:
                    ShowForm(UserControlType.UnifiOthersPlan);
                    break;
                case ButtonType.UnifiCallPlanCompleted:
                    ShowForm(UserControlType.UnifiHyppTv);
                    break;
                case ButtonType.UnifiMainDetailsCompleted:
                    ShowForm(UserControlType.UnifiCallPlan);
                    break;
                case ButtonType.DocumentUploadCompleted:
                    ShowForm(UserControlType.TermAndCondition);
                    break;
                case ButtonType.ServicesCompleted:
                    ShowForm(UserControlType.DocumentUpload);
                    break;
                case ButtonType.BillingCompleted:
                    switch (Application.ProductTypeEnum)
                    {
                        case ProductTypeEnum.Unifi:
                            ShowForm(UserControlType.UnifiMainDetails);
                            break;
                        case ProductTypeEnum.Streamyx:
                            ShowForm(UserControlType.ServiceDetails);
                            break;
                    }
                    break;
                case ButtonType.ApplicationDetailCompleted:
                    ShowForm(UserControlType.InstallationDetail);
                    break;
                case ButtonType.InstallationDetailCompleted:
                    ShowForm(UserControlType.BillingDetail);
                    break;
                case ButtonType.BillingDetailCompleted:
                    ShowForm(UserControlType.ServiceDetails);
                    break;
                case ButtonType.ApplicantTypeSelected:
                    {
                        switch (Application.ApplicantTypeEnum)
                        {
                            case ApplicantTypeEnum.Malaysian:
                                ShowForm(UserControlType.ApplicantDetails);
                                break;
                            case ApplicantTypeEnum.NonMalaysian:
                                ShowForm(UserControlType.ApplicantDetails);
                                break;
                            case ApplicantTypeEnum.Oku:
                                ShowForm(UserControlType.ApplicantDetails);
                                //MessageBox.Show("Test");
                                break;
                            case ApplicantTypeEnum.Tentera:
                                ShowForm(UserControlType.ApplicantDetails);
                                //MessageBox.Show("Test");
                                break;
                            default:
                                break;
                        }
                    }
                    break;
                case ButtonType.Syncrhonize:
                    ProcessingForm pf = new ProcessingForm();
                    pf.Title = "Synchronization";
                    pf.Message = "Synchronization is in progress...";
                    pf.ShowDialog();
                    break;
                case ButtonType.Dashboard:
                    ShowForm(UserControlType.Dashboard);
                    break;
                case ButtonType.SaveTrans:
                    {
                        try
                        {

                            //Models.ApplicationModel.Add(Application, UserProfile.IcNo);
                            _applicationSvc.Create(Application);
                            MessageBox.Show("Registration Success!");
                            RegistrationSlipForm rsf = new RegistrationSlipForm();
                            rsf.Trans = Application;
                            rsf.Show();
                            ShowForm(UserControlType.Dashboard);

                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Registration Failed! " + ex.Message);
                        }
                    }
                    break;
                case ButtonType.Start:
                    Application = new Data.Application();
                    ShowForm(UserControlType.ProductGroup);
                    break;
                case ButtonType.ApplicantType:
                    ShowForm(UserControlType.ApplicantType);
                    break;
                case ButtonType.RecentApplication:
                    ShowForm(UserControlType.RecentApplication);
                    break;
                case ButtonType.IncompleteApplication:
                    ShowForm(UserControlType.IncompleteApplication);
                    break;
                case ButtonType.MyPerformance:
                    MyPerformanceForm mpf = new MyPerformanceForm();
                    mpf.Show();
                    break;
                default:
                    break;
            }
            //switch (e.Type)
            //{
            //    case ButtonType.RecentApplication:
            //        ShowForm(UserControlType.RecentApplication);
            //        break;
            //    case ButtonType.IncompleteApplication:
            //        ShowForm(UserControlType.IncompleteApplication);
            //        break;
            //    default:
            //        ShowForm(UserControlType.ProductGroup);
            //        break;
            //}
        }
예제 #12
0
        void OnButtonClick(object sender, ButtonClickEventArgs e)
        {
            switch (e.Type)
            {
            case ButtonType.UnifiOthersPlanCompleted:
                ShowForm(UserControlType.DocumentUpload);
                break;

            case ButtonType.UnifiHyppTvCompleted:
                ShowForm(UserControlType.UnifiOthersPlan);
                break;

            case ButtonType.UnifiCallPlanCompleted:
                ShowForm(UserControlType.UnifiHyppTv);
                break;

            case ButtonType.UnifiMainDetailsCompleted:
                ShowForm(UserControlType.UnifiCallPlan);
                break;

            case ButtonType.DocumentUploadCompleted:
                ShowForm(UserControlType.TermAndCondition);
                break;

            case ButtonType.ServicesCompleted:
                ShowForm(UserControlType.DocumentUpload);
                break;

            case ButtonType.BillingCompleted:
                switch (Application.ProductTypeEnum)
                {
                case ProductTypeEnum.Unifi:
                    ShowForm(UserControlType.UnifiMainDetails);
                    break;

                case ProductTypeEnum.Streamyx:
                    ShowForm(UserControlType.ServiceDetails);
                    break;
                }
                break;

            case ButtonType.ApplicationDetailCompleted:
                ShowForm(UserControlType.InstallationDetail);
                break;

            case ButtonType.InstallationDetailCompleted:
                ShowForm(UserControlType.BillingDetail);
                break;

            case ButtonType.BillingDetailCompleted:
                ShowForm(UserControlType.ServiceDetails);
                break;

            case ButtonType.ApplicantTypeSelected:
            {
                switch (Application.ApplicantTypeEnum)
                {
                case ApplicantTypeEnum.Malaysian:
                    ShowForm(UserControlType.ApplicantDetails);
                    break;

                case ApplicantTypeEnum.NonMalaysian:
                    ShowForm(UserControlType.ApplicantDetails);
                    break;

                case ApplicantTypeEnum.Oku:
                    ShowForm(UserControlType.ApplicantDetails);
                    //MessageBox.Show("Test");
                    break;

                case ApplicantTypeEnum.Tentera:
                    ShowForm(UserControlType.ApplicantDetails);
                    //MessageBox.Show("Test");
                    break;

                default:
                    break;
                }
            }
            break;

            case ButtonType.Syncrhonize:
                ProcessingForm pf = new ProcessingForm();
                pf.Title   = "Synchronization";
                pf.Message = "Synchronization is in progress...";
                pf.ShowDialog();
                break;

            case ButtonType.Dashboard:
                ShowForm(UserControlType.Dashboard);
                break;

            case ButtonType.SaveTrans:
            {
                try
                {
                    //Models.ApplicationModel.Add(Application, UserProfile.IcNo);
                    _applicationSvc.Create(Application);
                    MessageBox.Show("Registration Success!");
                    RegistrationSlipForm rsf = new RegistrationSlipForm();
                    rsf.Trans = Application;
                    rsf.Show();
                    ShowForm(UserControlType.Dashboard);
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Registration Failed! " + ex.Message);
                }
            }
            break;

            case ButtonType.Start:
                Application = new Data.Application();
                ShowForm(UserControlType.ProductGroup);
                break;

            case ButtonType.ApplicantType:
                ShowForm(UserControlType.ApplicantType);
                break;

            case ButtonType.RecentApplication:
                ShowForm(UserControlType.RecentApplication);
                break;

            case ButtonType.IncompleteApplication:
                ShowForm(UserControlType.IncompleteApplication);
                break;

            case ButtonType.MyPerformance:
                MyPerformanceForm mpf = new MyPerformanceForm();
                mpf.Show();
                break;

            default:
                break;
            }
            //switch (e.Type)
            //{
            //    case ButtonType.RecentApplication:
            //        ShowForm(UserControlType.RecentApplication);
            //        break;
            //    case ButtonType.IncompleteApplication:
            //        ShowForm(UserControlType.IncompleteApplication);
            //        break;
            //    default:
            //        ShowForm(UserControlType.ProductGroup);
            //        break;
            //}
        }