public DealWindow(ViewDeal deal)
        {
            InitializeComponent();

            viewDeal = deal;

            using (var data = new DataServiceClient())
            {
                ComboBox_Seller.ItemsSource = data.GetUsersId();
                ComboBox_Buyer.ItemsSource = ComboBox_Seller.ItemsSource;
            }

            ComboBox_Buyer.IsEnabled = false;
            ComboBox_ObjOfTransact.IsEnabled = false;
            ComboBox_KindOfCalc.IsEnabled = false;
            TextBox_PersonalNumberOfDeal.IsEnabled = false;
            TextBox_DateOfDeal.IsEnabled = false;
            TextBox_TransactionAmount.IsEnabled = false;

            SetInfo();

            if (deal.DealID > 0)
            {
                Button_Correct.IsEnabled = true;
                Button_Add.IsEnabled = false;
            }
            else
            {
                Button_Correct.IsEnabled = false;
                Button_Add.IsEnabled = true;
            }
        }
 //
 // GET: /PersonalInfo/
 public async Task<ActionResult> Index()
 {
     var model = new PersonalInfoModel();
     if (((string)Session["Status"]).CompareTo("LoggedIn") == 0 && Convert.ToInt32(Session["ApplicantID"]) > 0)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             var personalInfo = await client.getPersonalInfoAsync(Convert.ToInt32(Session["ApplicantId"]));
             var auth = await client.getApplicantAuthInfoAsync(Convert.ToInt32(Session["ApplicantId"]));
             model.city = personalInfo.city;
             model.name_alt = personalInfo.alias;
             model.name_first = personalInfo.firstName;
             model.name_last = personalInfo.lastName;
             model.name_middle = personalInfo.middleName;
             model.email = personalInfo.email;
             model.phone_num = personalInfo.Phone;
             model.ssn = personalInfo.socialNum;
             model.password = auth.password;
             model.passVerification = auth.password;
             model.state = personalInfo.state;
             model.street = personalInfo.street;
             model.zip = personalInfo.zip;
             client.Close();
         }
     }
     return View(model);
 }
Пример #3
0
 public Home()
 {
     _client = new DataServiceClient();
     _client.GetLiquidsLevelCompleted += GetLiquidsLevelCompleted;
     _client.ReallyLongDataPullCompleted += ReallyLongDataPullCompleted;
     InitializeComponent();
 }
 public async Task<ActionResult> Index(List<JobHistoryModel> model)
 {
     if (ModelState.IsValid)
     {
         bool historyStored = false;
         using (var client = new DataServiceClient())
         {
             client.Open();
             var history = new List<JobHistory>();
             foreach (var jobHistory in model)
             {
                 int tempYear;
                 int tempMonth;
                 var jobHist = new JobHistory();
                 jobHist.street = jobHistory.street;
                 jobHist.city = jobHistory.city;
                 jobHist.stateAbrev = jobHistory.state;
                 jobHist.zip = jobHistory.zip;
                 jobHist.applicantId = Convert.ToInt32(this.Session["ApplicantId"]);
                 jobHist.duties = jobHistory.responsibilities;
                 jobHist.employer = jobHistory.employer;
                 jobHist.endSalary = jobHistory.salary_end;
                 jobHist.startSalary = jobHistory.salary_start;
                 if (jobHistory.from_year != null && jobHistory.from_month != null)
                 {
                     tempYear = Convert.ToInt32(jobHistory.from_year);  
                     tempMonth = Convert.ToInt32(jobHistory.from_month); 
                     jobHist.fromDate = new DateTime(tempYear, tempMonth, 1);
                     tempYear = Convert.ToInt32(jobHistory.to_year);  
                     tempMonth = Convert.ToInt32(jobHistory.to_month); 
                     jobHist.toDate = new DateTime(tempYear, tempMonth, 1);
                 }
                 else
                 {
                     jobHist.toDate = null;
                     jobHist.fromDate = null;
                 }
                 jobHist.phone = jobHistory.phone;
                 jobHist.position = jobHistory.position;
                 jobHist.reasonLeave = jobHistory.reason_for_leaving;
                 jobHist.supervisor = jobHistory.supervisor;
                 jobHist.applicantId = jobHistory.applicantId;
                 jobHist.jobHistoryId = jobHistory.historyId;
                 history.Add(jobHist);
             }
             historyStored = await client.updateJobHistoryAsync(history.ToArray());
             client.Close();
         }
         if (historyStored/**true**/)
         {
             this.Session["JobHistory"] = "Done";
             return RedirectToAction("Index", "Education");
         }
         else
         {
             //error in storing history... add error view or determine action??
         }
     }
     return View(model);
 }
 public async Task<ActionResult> Index(FormCollection fc )
 {
     Session["DisableMenu"] = "Yes";
     var questions = new List<QuestionModel>();
     List<int> ids = new List<int>();
     for (int i = 1; i < fc.Count; i++ )
     {
          ids.Add(Convert.ToInt32(fc.Keys.Get(i)));
     }
     if (ids.Count < 1)
         return RedirectToAction("Index", "LocalJobs");
     else
         this.Session.Add("jobIds", ids.ToArray());
     
     using (var client = new DataServiceClient())
     {
         var tempQuestions = await client.getQuestionsAsync(ids.ToArray());
         foreach (var question in tempQuestions)
         {
             var tempQuestion = new QuestionModel();
             tempQuestion.question = question.theQuestion;
             tempQuestion.correctAnswer = question.theAnswer;
             questions.Add(tempQuestion);
         }
     }
     return View(questions);
 }
 public async Task<ActionResult> CheckQuestions(List<QuestionModel> questionnair)
 {
     Session["DisableMenu"] = "No";
     bool questionFailed = false;
     if (questionnair != null)
     {
         foreach (var question in questionnair)
         {
             if (question.correctAnswer[0] != question.response[0])
                 questionFailed = true;
         }
     }
     if (questionFailed) 
     {
         return RedirectToAction("Fail", "Questionnaire"); 
     }
     if (((string)Session["Status"]).CompareTo("LoggedIn") == 0)
     {
         using (var client = new DataServiceClient())
         {
             if (!await client.updateJobIdsAsync(Convert.ToInt32(Session["ApplicantId"]), (int[])this.Session["jobIds"]))
             {
                 //error storing jobIds (when logged in this is stored after questionnair)    
             }
             else
             {
                 this.Session["LocalJobs"] = "Done";
             }
         }
     }
     return RedirectToAction("Index","PersonalInfo");
 }
 private void Button_Yes_Click(object sender, RoutedEventArgs e)
 {
     switch (objName)
     {
         case "User":
         {
             using (var data = new DataServiceClient())
             {
                 data.DeleteUser((ViewUser)obj);
             }
         }break;
         case "ObjOfTransact":
         {
             using (var data = new DataServiceClient())
             {
                 data.DeleteObjectOfTransaction((ViewObjOfTransact)obj);
             }
         }break;
         case "Deal":
         {
             using (var data = new DataServiceClient())
             {
                 data.DeleteDeal((ViewDeal)obj);
             }
         }break;
     }
     this.Close();
 }
 public async Task<ActionResult> ApplicationFinished()
 {
     bool signatureStored = false;
     using (var client = new DataServiceClient())
     {
         client.Open();
         var sig = new ElectronicSig();
         sig.date = DateTime.Now;
         sig.applicantId = Convert.ToInt32(this.Session["applicantId"]);
         //Can't use jobIds session variable here if logging in as a return user, it will always be null.
         int[] _jobIds = await client.getJobsAppliedForAsync(sig.applicantId);
         signatureStored = await client.updateElectronicSigAsync(sig, _jobIds);
         client.Close();
     }
     if (signatureStored)
     {
         this.Session["ESignature"] = "Done";
         return RedirectToAction("Index", "PhoneScreen");
     }
     else
     {
         //error in storing signature
     }
     return RedirectToAction("Index", "ESignature");
 }
Пример #9
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //System.ServiceModel.Channels.CustomBinding binding = new System.ServiceModel.Channels.CustomBinding();
               // binding.MaxReceivedMessageSize = 2147483647;

            DataServiceClient client = new DataServiceClient();

            if (client.GetWebPredict().Length>0)
            {
                string body = client.GetWebData();
                //Response.Write(body);
                string jsonString = DecryptAES(body, "qjkHuIy9D/9i=", "Mi9l/+7Zujhy12se6Yjy111A");
                Response.Write(jsonString);

                //Response.Write(client.GetWebPredict());

                //string abcd=System.Text.Encoding.ASCII.;
               // Response.Write(abc);

               // byte[] buffer = System.Text.Encoding.UTF8.GetBytes(body);
                //byte[] ss = Convert.FromBase64String(body);

                //string s = System.Text.Encoding.ASCII.GetString(ss);
                //string s = System.Text.Encoding.UTF8.GetString(ss);
                //string s = System.Text.Encoding.Default.GetString(ss);
                //string s = System.Text.Encoding.Unicode.GetString(ss);

            //                 var stream = new MemoryStream(ss);
            //                 var result = new BinaryFormatter().Deserialize(stream);

                //Response.Write(client.GetWebPredict().ToString());

                client.Close();
            }
        }
Пример #10
0
 public ActionResult SearchByName(AESManagement.Models.searchModel searchModel)
 {
     int appId = -1;
     if (searchModel.firstname != null && searchModel.lastname != null)
     {
         try
         {
             using (DataServiceClient client = new DataServiceClient())
             {
                 if (Session["_Locked"] != null)
                     client.unlockApp((int)Session["_Locked"]);
                 
                 var result = client.getApplicationsWithName(searchModel.firstname, searchModel.lastname);
                 if (result.Count() > 0)
                 {
                     appId = result.First();
                     client.lockApp(appId);
                     Session["_Locked"] = appId;
                 }
             }
         }
         catch (Exception)
         { }
     }
     return Redirect("Applicant/" + appId.ToString());
 }
Пример #11
0
        static void Main(string[] args)
        {
            DataServiceClient client = new DataServiceClient();

            if (client.GetWebPredict().Length > 0)
            {
                string webData = client.GetWebData();
                //string aaaa=webData.Replace("//","");

                string jsonString = DecryptAES(webData, "qjkHuIy9D/9i=", "Mi9l/+7Zujhy12se6Yjy111A");

                Console.Write(jsonString);
                //Console.ReadKey();

                //string webPredict = client.GetWebPredict();
                //JsonValue value3 = JsonValue.Parse(webPredict)["Table"];

               // Console.Write(webPredict);

               // Console.ReadKey();
                //string webAlert = client.GetWebAlert();
                //Console.Write(webAlert);

                client.Close();
            }
        }
Пример #12
0
 public RadDbCustomDictionary()
 {
     this.AutoUpdateDataBase = true;
     this.dataServiceClient = new DataServiceClient();
     this.dataServiceClient.GetAllWordsCompleted += OnGetAllWordsCompleted;
     this.dataServiceClient.UpdateWordsCompleted += OnUpdateWordsCompleted;
     this.dataServiceClient.GetAllWordsAsync();
 }
Пример #13
0
        public void GetAllBranches()
        {
            var dataService = new DataServiceClient();

            var branches = dataService.GetBranches();

            Assert.IsTrue(branches.Any());
        }
 //
 // GET: /JobHistory/
 public async Task<ActionResult> Index()
 {
     var model = new List<JobHistoryModel>();
     JobHistoryModel modelElement;
     for (int i = 0; i < 3; i++)
     {
         modelElement = new JobHistoryModel();
         model.Add(modelElement);
     }
     if (((string)Session["Status"]).CompareTo("LoggedIn") == 0 && Convert.ToInt32(Session["ApplicantId"]) > 0)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             var allHistories = await client.getJobHistoriesAsync(Convert.ToInt32(Session["ApplicantId"]));
             if (allHistories.Length < 3)
             {
                 foreach (var element in model)
                 {
                     element.applicantId = Convert.ToInt32(Session["ApplicantId"]);
                 }
             }
             else
             {
                 model.Clear();
                 foreach (var history in allHistories)
                 {
                     modelElement = new JobHistoryModel();
                     modelElement.city = history.city == null ? history.city : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(history.city.ToLower());
                     modelElement.employer = history.employer == null ? history.employer : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(history.employer.ToLower());
                     modelElement.from_month = history.fromDate == null ? "" : history.fromDate.Value.Month.ToString();
                     modelElement.from_year = history.fromDate == null ? "" : history.fromDate.Value.Year.ToString();
                     modelElement.phone = history.phone;
                     modelElement.position = history.position == null ? history.position : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(history.position.ToLower());
                     modelElement.reason_for_leaving = history.reasonLeave;
                     modelElement.responsibilities = history.duties;
                     modelElement.salary_end = history.endSalary;
                     modelElement.salary_start = history.startSalary;
                     modelElement.state = history.stateAbrev == null ? null : history.stateAbrev.ToUpper();
                     modelElement.street = history.street == null ? history.street : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(history.street.ToLower());
                     modelElement.supervisor = history.supervisor == null ? history.supervisor : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(history.supervisor.ToLower());
                     modelElement.to_month = history.toDate == null ? "" : history.toDate.Value.Month.ToString();
                     modelElement.to_year = history.toDate == null ? "" : history.toDate.Value.Year.ToString();
                     modelElement.zip = history.zip;
                     modelElement.applicantId = history.applicantId;
                     modelElement.historyId = history.jobHistoryId;
                     model.Add(modelElement);
                 }
             }
             client.Close();
         }
     }
     else
     {
         //error not logged in or applicantId not set correctly
     }
     return View(model);
 }
 public async Task<ActionResult> Index(PersonalInfoModel model)
 {
     int tempId = -1;
     var auth = new ApplicantAuth();
     var personalInfo = new PersonalInfo();
     
     if (ModelState.IsValid)
     {
         personalInfo.firstName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_first.ToLower());
         personalInfo.middleName = model.name_middle == null ? model.name_middle : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_middle);
         personalInfo.lastName = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_last.ToLower());
         personalInfo.alias = model.name_alt == null? model.name_alt : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.name_alt.ToLower());
         personalInfo.street = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.street.ToLower());
         personalInfo.city = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.city.ToLower());
         personalInfo.state = model.state.ToUpper();
         personalInfo.email = model.email;
         personalInfo.zip = model.zip;
         personalInfo.Phone = model.phone_num;
         personalInfo.socialNum = model.ssn;
         personalInfo.applicantId = Convert.ToInt32(Session["ApplicantId"]);
         using (var client = new DataServiceClient())
         {
             client.Open();
             tempId = await client.updatePersonalInfoAsync(personalInfo);
             if (tempId > 0)
             {
                 if (((string)Session["Status"]).CompareTo("LoggedIn") != 0)
                 {
                     if (!await client.updateJobIdsAsync(tempId, (int[])this.Session["jobIds"]))
                     {
                         //error storing jobIds (when logged in this is stored after questionnair)    
                     }
                     else
                     {
                         this.Session["LocalJobs"] = "Done";
                     }
                 }
                 this.Session["ApplicantId"] = tempId;
                 this.Session["PersonalInfo"] = "Done";
                 auth.applicantId = tempId;
                 auth.password = model.password;
                 if (!await client.updatePasswordAsync(auth))
                 {
                     //error saving password 
                 }
                 Session["Status"] = "LoggedIn";
                 return RedirectToAction("Index", "Availability");
             }
             else
             {
                 //error occured, update failed
             }
             client.Close();
         }
     }
     return View(model);
 }
Пример #16
0
        public ActionResult Approve(int appId = -1)
        {
            using (DataServiceClient client = new DataServiceClient())
            {
                client.unlockApp(appId);
                client.updateStatus(appId, "approved");
            }

            return RedirectToAction("Applicant", "Application",-1);
        }
Пример #17
0
        public ActionResult UpdateNotes(AESManagement.Models.NoteModel noteModel)
        {
                using (DataServiceClient client = new DataServiceClient())
                {
                    client.unlockApp(noteModel.appId);
                    client.updateNotes(noteModel.appId, noteModel.note);
                }

                return RedirectToAction("Applicant", "Application", -1);
        }
Пример #18
0
        //[Test]
        public void UpdateFaculty()
        {
            var dataService = new DataServiceClient();

            var branch = dataService.GetBranches().Last();

            var faculty = dataService.GetFaculties(new Branch { Id = 297 }).Last();
            faculty.BranchId = branch.Id;

            var result = dataService.Update(faculty);
        }
 //
 // GET: /Education/
 public async Task<ActionResult> Index()
 {
     var model = new List<EducationModel>();
     EducationModel modelElement;
     for (int i = 0; i < 3; i++)
     {
         modelElement = new EducationModel();
         model.Add(modelElement);
     }
     if (((string)Session["Status"]).CompareTo("LoggedIn") == 0 && Convert.ToInt32(Session["ApplicantID"]) > 0)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             var educations = await client.getEducationAsync(Convert.ToInt32(Session["ApplicantId"]));
             if (educations.Length < 3)
             {
                 foreach (var element in model)
                 {
                     element.applicantId = Convert.ToInt32(Session["ApplicantID"]);
                 }
             }
             else
             {
                 model.Clear();
                 foreach (var education in educations)
                 {
                     modelElement = new EducationModel();
                     modelElement.city = education.city == null ? education.city : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(education.city.ToLower());
                     modelElement.degree = education.degreeMajor == null ? education.degreeMajor : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(education.degreeMajor.ToLower());
                     modelElement.graduated = education.graduatedYN == null ? null : education.graduatedYN.ToLower();
                     modelElement.name = education.name == null ? education.name : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(education.name.ToLower());
                     modelElement.state = education.stateAbrev == null ? null : education.stateAbrev.ToUpper();
                     modelElement.street = education.street == null ? education.street : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(education.street.ToLower());
                     modelElement.yearFrom = education.yearFrom;
                     modelElement.yearTo = education.yearTo;
                     modelElement.zip = education.zip;
                     modelElement.applicantId = education.applicantId;
                     modelElement.educationId = education.educationId;
                     model.Add(modelElement);
                 }
             }
             client.Close();
         }
     }
     else
     {
         //error must login or applicantId not set properly on login
     }
     return View(model);
 }
Пример #20
0
        static void Main(string[] args)
        {
            DataServiceClient service = new DataServiceClient();
            Person p = service.GetPerson();
            Console.WriteLine(p);

            int a = 5, b = 3;
            service.Swap(ref a, ref b);
            Console.WriteLine("{0} {1}",a,b);

            Person[] members = service.GetAllMembers();
           

            Console.ReadLine();
        }
 //
 // GET: /LocalJobs/
 public async Task<ActionResult> Index()
 {
     var jobs = new List<JobModel>();
     using (var client = new DataServiceClient())
     {
         client.Open();
         
         var loadedJobs = await client.getJobsAsync(Convert.ToInt32(this.Session["storeId"]));
         var jobsSelected = new List<int>();
         if (((string)this.Session["Status"]).CompareTo("LoggedIn") == 0)
         {
             jobsSelected.AddRange(await client.getJobsAppliedForAsync(Convert.ToInt32(this.Session["ApplicantId"])));
         }
         foreach (var job in loadedJobs)
         {
             var availPos = client.getAvailablePosition(job.availablePositionId);
             var pos = client.getPosition(availPos.positionId);
             var tempJob = new JobModel();
             tempJob.selected = jobsSelected.Contains(job.availablePositionId) ? 1 : 0;
             tempJob.jobId = pos.positionId;
             tempJob.description = job.description;
             tempJob.requirements = job.requirements;
             tempJob.education = job.education;
             tempJob.title = job.title;
             tempJob.pay = job.pay;
             tempJob.location = job.location;
             tempJob.mondayFrom = job.mondayFrom != null ? DateTime.Today.Add((TimeSpan)job.mondayFrom).ToString("hh:mm tt"): "-" ;
             tempJob.mondayTo = job.mondayTo != null ? DateTime.Today.Add((TimeSpan)job.mondayTo).ToString("hh:mm tt") : "-";
             tempJob.tuesdayFrom = job.tuesdayFrom != null ? DateTime.Today.Add((TimeSpan)job.tuesdayFrom).ToString("hh:mm tt") : "-";
             tempJob.tuesdayTo = job.tuesdayTo != null ? DateTime.Today.Add((TimeSpan)job.tuesdayTo).ToString("hh:mm tt") : "-";
             tempJob.wednesdayFrom = job.wednesdayFrom != null ? DateTime.Today.Add((TimeSpan)job.wednesdayFrom).ToString("hh:mm tt") : "-";
             tempJob.wednesdayTo = job.wednesdayTo != null ? DateTime.Today.Add((TimeSpan)job.wednesdayTo).ToString("hh:mm tt") : "-";
             tempJob.thursdayFrom = job.thursdayFrom != null ? DateTime.Today.Add((TimeSpan)job.thursdayFrom).ToString("hh:mm tt") : "-";
             tempJob.thursdayTo = job.thursdayTo != null ? DateTime.Today.Add((TimeSpan)job.thursdayTo).ToString("hh:mm tt") : "-";
             tempJob.fridayFrom = job.fridayFrom != null ? DateTime.Today.Add((TimeSpan)job.fridayFrom).ToString("hh:mm tt") : "-";
             tempJob.fridayTo = job.fridayTo != null ? DateTime.Today.Add((TimeSpan)job.fridayTo).ToString("hh:mm tt") : "-";
             tempJob.saturdayFrom = job.saturdayFrom != null ? DateTime.Today.Add((TimeSpan)job.saturdayFrom).ToString("hh:mm tt") : "-";
             tempJob.saturdayTo = job.saturdayTo != null ? DateTime.Today.Add((TimeSpan)job.saturdayTo).ToString("hh:mm tt") : "-";
             tempJob.sundayFrom = job.sundayFrom != null ? DateTime.Today.Add((TimeSpan)job.sundayFrom).ToString("hh:mm tt") : "-";
             tempJob.sundayTo = job.sundayTo != null ? DateTime.Today.Add((TimeSpan)job.sundayTo).ToString("hh:mm tt") : "-";
             jobs.Add(tempJob);
         }
         client.Close();
     }
   
     return View(jobs);
 }
 //
 // GET: /References/
 public async Task<ActionResult> Index()
 {
     var model = new List<ReferenceModel>();
     ReferenceModel modelElement;
     for (int i = 0; i < 3; i++)
     {
         modelElement = new ReferenceModel();
         model.Add(modelElement);
     }
     if (((string)Session["Status"]).CompareTo("LoggedIn") == 0 && Convert.ToInt32(Session["ApplicantID"]) > 0)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             //the problem here is what if the reference never got saved in the first place?
             var references = await client.getReferencesAsync(Convert.ToInt32(Session["ApplicantId"]));
             if (references.Length < 3)
             {
                 foreach (var element in model)
                 {
                     element.applicantId = Convert.ToInt32(Session["ApplicantId"]);
                 }
             }
             else
             {
                 model.Clear();
                 foreach (var reference in references)
                 {
                     modelElement = new ReferenceModel();
                     modelElement.company = reference.company == null ? reference.company : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(reference.company.ToLower());
                     modelElement.name = reference.name == null ? reference.name : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(reference.name.ToLower());
                     modelElement.phone = reference.phone;
                     modelElement.title = reference.title == null ? reference.title : CultureInfo.CurrentCulture.TextInfo.ToTitleCase(reference.title.ToLower());
                     modelElement.applicantId = reference.applicantId;
                     modelElement.referenceId = reference.referenceId;
                     model.Add(modelElement);
                 }
             }
             client.Close();
         }
     }
     else 
     {
         //error not logged in or login failed to load ApplicantId 
     }
     return View(model);
 }
 //
 // GET: /Availability/
 public async Task<ActionResult> Index()
 {
     var model = new AvailabilityModel();
     if (((string)Session["Status"]).CompareTo("LoggedIn") == 0 && Convert.ToInt32(Session["ApplicantID"]) > 0)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             var availability = await client.getAvailabilityAsync(Convert.ToInt32(Session["ApplicantId"]));
             if (availability.applicantId <= 0)
             {
                 model.applicantId = Convert.ToInt32(Session["ApplicantID"]);
             }
             else
             {
                 model.daysYN = availability.daysYN;
                 model.eveningsYN = availability.eveningsYN;
                 model.fridayFrom = availability.fridayFrom == null ? 0 : availability.fridayFrom.Value.Hours + 1;
                 model.fridayTo = availability.fridayTo == null ? 0 : availability.fridayTo.Value.Hours + 1;
                 model.fullTimeYN = availability.fullTimeYN;
                 model.mondayFrom = availability.mondayFrom == null ? 0 : availability.mondayFrom.Value.Hours + 1;
                 model.mondayTo = availability.mondayTo == null ? 0 : availability.mondayTo.Value.Hours + 1;
                 model.salaryExpected = availability.salaryExpected;
                 model.saturdayFrom = availability.saturdayFrom == null ? 0 : availability.saturdayFrom.Value.Hours + 1;
                 model.saturdayTo = availability.saturdayTo == null ? 0 : availability.saturdayTo.Value.Hours + 1;
                 model.sundayFrom = availability.sundayFrom == null ? 0 : availability.sundayFrom.Value.Hours + 1;
                 model.sundayTo = availability.sundayTo == null ? 0 : availability.sundayTo.Value.Hours + 1;
                 model.thursdayFrom = availability.thursdayFrom == null ? 0 : availability.thursdayFrom.Value.Hours + 1;
                 model.thursdayTo = availability.thursdayTo == null ? 0 : availability.thursdayTo.Value.Hours + 1;
                 model.tuesdayFrom = availability.tuesdayFrom == null ? 0 : availability.tuesdayFrom.Value.Hours + 1;
                 model.tuesdayTo = availability.tuesdayTo == null ? 0 : availability.tuesdayTo.Value.Hours + 1;
                 model.wednesdayFrom = availability.wednesdayFrom == null ? 0 : availability.wednesdayFrom.Value.Hours + 1;
                 model.wednesdayTo = availability.wednesdayTo == null ? 0 : availability.wednesdayTo.Value.Hours + 1;
                 model.weekendsYN = availability.weekendsYN;
                 model.applicantId = availability.applicantId;
             }
             client.Close();
         }
     }
     else
     {
         //error need to login or applicantId not properly set
     }
     return View(model);
 }
 public async Task<ActionResult> Index(AvailabilityModel model)
 {
     bool saveSuccessful = false;
     if (ModelState.IsValid)
     {
         using (var client = new DataServiceClient())
         {
             client.Open();
             var infoToStore = new Availability();
             infoToStore.applicantId = Convert.ToInt32(this.Session["ApplicantId"]);
             infoToStore.daysYN = model.daysYN;
             infoToStore.eveningsYN = model.eveningsYN;
             infoToStore.weekendsYN = model.weekendsYN;
             infoToStore.fullTimeYN = model.fullTimeYN;
             infoToStore.salaryExpected = model.salaryExpected;
             infoToStore.mondayFrom = model.mondayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.mondayFrom - 1, 0, 0)) : null;
             infoToStore.mondayTo = model.mondayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.mondayTo - 1, 0, 0)) : null;
             infoToStore.tuesdayFrom = model.tuesdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.tuesdayFrom - 1, 0, 0)) : null;
             infoToStore.tuesdayTo = model.tuesdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.tuesdayTo - 1, 0, 0)) : null;
             infoToStore.wednesdayFrom = model.wednesdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.wednesdayFrom - 1, 0, 0)) : null;
             infoToStore.wednesdayTo = model.wednesdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.wednesdayTo - 1, 0, 0)) : null;
             infoToStore.thursdayFrom = model.thursdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.thursdayFrom - 1, 0, 0)) : null;
             infoToStore.thursdayTo = model.thursdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.thursdayTo - 1, 0, 0)) : null;
             infoToStore.fridayFrom = model.fridayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.fridayFrom - 1, 0, 0)) : null;
             infoToStore.fridayTo = model.fridayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.fridayTo - 1, 0, 0)) : null;
             infoToStore.saturdayFrom = model.saturdayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.saturdayFrom - 1, 0, 0)) : null;
             infoToStore.saturdayTo = model.saturdayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.saturdayTo - 1, 0, 0)) : null;
             infoToStore.sundayFrom = model.sundayFrom > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.sundayFrom - 1, 0, 0)) : null;
             infoToStore.sundayTo = model.sundayTo > 0 ? new Nullable<TimeSpan>(new TimeSpan(model.sundayTo - 1, 0, 0)) : null;
             infoToStore.applicantId = model.applicantId;
             saveSuccessful = await client.updateAvailabilityAsync(infoToStore);
             client.Close();
         }
         if (saveSuccessful)
         {
             this.Session["Availability"] = "Done";
             return RedirectToAction("Index", "JobHistory");
         }
         else
         {
             //some error has occured saving --currently do nothing
         }
     }
     return View(model);
 }
Пример #25
0
        public override void ExecuteCmdlet()
        {
            if (InputObject != null)
            {
                VaultName = InputObject.VaultName;
                Name      = InputObject.Name;
            }

            if (InRemovedState.IsPresent)
            {
                ConfirmAction(
                    Force.IsPresent,
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.RemoveDeletedSecretWarning,
                        Name),
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.RemoveDeletedSecretWhatIfMessage,
                        Name),
                    Name,
                    () => { DataServiceClient.PurgeSecret(VaultName, Name); });
                return;
            }

            PSDeletedKeyVaultSecret deletedSecret = null;

            ConfirmAction(
                Force.IsPresent,
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.RemoveSecretWarning,
                    Name),
                string.Format(
                    CultureInfo.InvariantCulture,
                    Resources.RemoveSecretWhatIfMessage,
                    Name),
                Name,
                () => { deletedSecret = DataServiceClient.DeleteSecret(VaultName, Name); });

            if (PassThru)
            {
                WriteObject(deletedSecret);
            }
        }
Пример #26
0
        public int SelectVoucherImageId(int iso, int v_number)
        {
            #region SQL

            const string SQL = "SELECT id FROM VOUCHER WHERE iso_id = @iso_id and v_number = @v_number;";

            #endregion

            using (var comm = new SqlCommand(SQL))
            {
                comm.Parameters.AddWithValue("@iso_id", iso);
                comm.Parameters.AddWithValue("@v_number", v_number);
                var data = comm.CreateSerializationData().ToList().ToArray();
                DataServiceClient client = new DataServiceClient();
                var result = client.ImagesExecuteScalar(data);
                return(result.Cast <int>(-1));
            }
        }
        public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
            case BySecretNameParameterSet:
                var secret = DataServiceClient.GetSecret(VaultName, Name, Version);
                WriteObject(secret);
                break;

            case ByVaultNameParameterSet:
                var secrets = DataServiceClient.GetSecrets(VaultName);
                WriteObject(secrets, true);
                break;

            default:
                throw new ArgumentException(Resources.BadParameterSetName);
            }
        }
Пример #28
0
 public WorkerViewModel(DataServiceClient dataClient, WorkerViewModelValidator validator, INavigator navigator)
 {
     Busy            = true;
     busyCount       = 1;
     this.dataClient = dataClient;
     this.validator  = validator;
     Navigator       = navigator;
     Enabled         = true;
     InitCommands();
     this.dataClient.FindWorkersCompleted += FindWorkersCompleted;
     this.dataClient.FindWorkersAsync(LoginInit.user.DetachmentID);
     this.dataClient.FindToursCompleted += FindToursCompleted;
     this.dataClient.FindToursAsync(LoginInit.user.DetachmentID);
     PropertyChanged += (s, e) =>
     {
         (SaveCommand as Command).OnCanExecuteChanged();
     };
 }
Пример #29
0
 public AccountViewModel(DataServiceClient dataClient, INavigator navigator)
 {
     Busy               = true;
     this.dataClient    = dataClient;
     validator          = new AccountViewModelValidator();
     Navigator          = navigator;
     UserName           = LoginInit.user.Name;
     WriteAutorization  = LoginInit.user.Roles.Any(c => c.Name == "Write");
     AdminAutorization  = LoginInit.user.Roles.Any(c => c.Name == "Admin");
     MasterAutorization = LoginInit.user.Roles.Any(c => c.Name == "Master");
     InitCommands();
     this.dataClient.FindDetachmentCompleted += FindDetachmentCompleted;
     this.dataClient.FindDetachmentAsync(LoginInit.user.DetachmentID);
     PropertyChanged += (s, e) =>
     {
         (ChangeCommand as Command).OnCanExecuteChanged();
     };
 }
        public override void ExecuteCmdlet()
        {
            switch (ParameterSetName)
            {
            case ByKeyNameParameterSet:
                var keyBundle = DataServiceClient.GetKey(VaultName, Name, Version);
                WriteObject(keyBundle);
                break;

            case ByVaultNameParameterSet:
                IEnumerable <KeyIdentityItem> keyBundles = DataServiceClient.GetKeys(VaultName);
                WriteObject(keyBundles, true);
                break;

            default:
                throw new ArgumentException(Resources.BadParameterSetName);
            }
        }
Пример #31
0
        private void LayoutRoot_Loaded(object sender, RoutedEventArgs e)
        {
            NavigationCommands.BrowseBack.InputGestures.Clear();
            NavigationCommands.BrowseForward.InputGestures.Clear();
            if (pxy == null)
            {
                pxy = new DataServiceClient();
            }
            txtUserName.Text = "Welcome, " + Global.UserName + "  ";

            if (Global.UserType == Const.User)
            {
                Global.DashBoard = false;
                MainRegion.Navigate(new Product(Global.GlobalPageMode));
                return;
            }
            MainRegion.Navigate(new Dashboard(MainRegion));
        }
 public InvoiceProductPatchViewModel()
 {
     if (pxyInvoice == null)
     {
         pxyInvoice = new InvoiceServiceClient();
     }
     lstProduct = new ObservableCollection <ProductList>();
     using (DataServiceClient pxyData = new DataServiceClient())
     {
         lstProduct = pxyData.GetProductList();
     }
     cmdGenerateExcel = new DelegateCommand <object>(cmdGenerateExcel_Execute);
     cmdUploadExcel   = new DelegateCommand <object>(cmdUploadExcel_Execute, cmdUploadExcel_CanExecute);
     cmdErrorFile     = new DelegateCommand <object>(cmdErrorFile_Execute, cmdErrorFile_CanExecute);
     cmdBlankDate     = new DelegateCommand <object>(cmdBlankDate_Execute);
     cmdClear         = new DelegateCommand <object>(cmdClear_Execute);
     ClearValues();
 }
        public override void ExecuteCmdlet()
        {
            if (InputObject != null)
            {
                VaultName = InputObject.VaultName;
                Name      = InputObject.Name;
            }

            if (ShouldProcess(Name, Properties.Resources.SetSecret))
            {
                var secret = DataServiceClient.SetSecret(
                    VaultName,
                    Name,
                    SecretValue,
                    new PSKeyVaultSecretAttributes(!Disable.IsPresent, Expires, NotBefore, ContentType, Tag));
                WriteObject(secret);
            }
        }
        private void Button_Add_Click(object sender, RoutedEventArgs e)
        {
            PreapareObject();
            try
            {
                using (var data = new DataServiceClient())
                {
                    data.AddUser(viewUser);
                }
                MessageBox.Show("Transaction successful !");
            }
            catch (Exception)
            {
                MessageBox.Show("Error !");
            }

            this.Close();
        }
Пример #35
0
 private void CreateRemoteClient_Click(object sender, System.EventArgs e)
 {
     new MethodInvoker(() =>
     {
         this.BeginInvokeSafe(new MethodInvoker(() => errorProvider.SetError(btnCreateClient, null)));
         try
         {
             string url         = SettingsTable.Get <string>(Strings.All_CentralServerUrl, Strings.All_CentralServerUrlPathDefault);
             string machineName = PTFUtils.GetMachine();
             var clientId       = DataServiceClient.CallCreateClient(machineName);
         }
         catch (Exception ex)
         {
             this.BeginInvokeSafe(new MethodInvoker(() => errorProvider.SetError(btnCreateClient, ex.Message)));
             throw;
         }
     }).FireAndForget();
 }
Пример #36
0
        private void SendMessages(DataServiceClient client)
        {
            //******************************************************************
            //  SEND MESSAGES TO THE SERVER
            //******************************************************************
            Trace.WriteLine("TransferringService: ClientDataAccess.SelectMessagesForExport");

            int msgCount = (Settings != null && Settings.MaximumMessagesForExport > 0) ?
                           Settings.MaximumMessagesForExport :
                           Program.MAXIMUM_MESSAGES_FOR_EXPORT;

            List <DbMessageInfo> messages = ClientDataAccess.SelectMessagesForExport(msgCount);

            if (messages != null && messages.Count > 0)
            {
                foreach (var msg in messages)
                {
                    Stopwatch w = Stopwatch.StartNew();
                    Trace.WriteLine("TransferringService: client.SaveMessageXmlText");
                    Hashtable table = new Hashtable();
                    table.Add("Message", msg.Message);
                    //TODO: Hardcode
                    table.Add("Source", 0);
                    table.Add("StackTrace", msg.StackTrace);
                    table.Add("Type", msg.Type);
                    table.Add("DateInserted", msg.DateInserted);
#warning TODO
                    ////////using (ProtectedXml xml = new ProtectedXml(ProtectionOptions.Encript))
                    ////////{
                    ////////    xml.AddElement("MSG", table);
                    ////////    client.SaveMessageXmlText(xml.OuterXml);
                    ////////    Trace.WriteLine("TransferringService: ".concat(w.Elapsed));
                    ////////}

                    ClientDataAccess.SetMessageExportedAsync(msg.MessageID);

                    Thread.Sleep(0);
                }
            }
            else
            {
                Trace.WriteLine("TransferringService: MESSAGES to Send (OK)");
            }
        }
 public void OnCreateExecute()
 {
     Busy       = true;
     Changeover = new Changeover
     {
         DateID        = Date.ID,
         DateContent   = Date.DateContent,
         IsNight       = Date.IsNight,
         Description   = String.IsNullOrWhiteSpace(FaultDescription) ? SelectedTopFaultWork : FaultDescription,
         DetachmentID  = LoginInit.user.DetachmentID,
         VehicleID     = SelectedVehicle.ID,
         VehicleNumber = SelectedVehicle.Number,
         WorkTypeID    = SelectedWorkType.ID,
         WorkTypeName  = SelectedWorkType.Name
     };
     dataClient = ContainerProvider.GetInstance.Resolve <DataServiceClient>();
     dataClient.AddChangeoverCompleted += AddChangeoverCompleted;
     dataClient.AddChangeoverAsync(Changeover);
 }
Пример #38
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);
            IUnityContainer container = ContainerProvider.GetInstance;

            container.RegisterType <INavigator, Navigator>();
            container.RegisterType <DataServiceClient, DataServiceClient>(
                new GetterLifetimeManager(
                    () =>
            {
                var dataClient = new DataServiceClient();
                dataClient.ClientCredentials.UserName.UserName = LoginInit.user.Name;
                dataClient.ClientCredentials.UserName.Password = LoginInit.user.Password;
                dataClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
                return(dataClient);
            }));

            container.RegisterType <SecurityServiceClient, SecurityServiceClient>(
                new GetterLifetimeManager(
                    () =>
            {
                var securityClient = new SecurityServiceClient();
                securityClient.ClientCredentials.UserName.UserName = LoginInit.user.Name;
                securityClient.ClientCredentials.UserName.Password = LoginInit.user.Password;
                securityClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
                return(securityClient);
            }));

            container.RegisterType <FullTextServiceClient, FullTextServiceClient>(
                new GetterLifetimeManager(
                    () =>
            {
                var fullTextClient = new FullTextServiceClient();
                fullTextClient.ClientCredentials.UserName.UserName = LoginInit.user.Name;
                fullTextClient.ClientCredentials.UserName.Password = LoginInit.user.Password;
                fullTextClient.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = System.ServiceModel.Security.X509CertificateValidationMode.None;
                return(fullTextClient);
            }));

            var navigator = container.Resolve <INavigator>();

            navigator.Startup <LoginView, LoginViewModel>(ViewMode.Window);
        }
Пример #39
0
        public override void ExecuteCmdlet()
        {
            NormalizeParameterSets();

            if (ShouldProcess(Name, Properties.Resources.RecoverKey))
            {
                PSKeyVaultKey recoveredKey;
                if (string.IsNullOrEmpty(HsmName))
                {
                    recoveredKey = DataServiceClient.RecoverKey(VaultName, Name);
                }
                else
                {
                    recoveredKey = this.Track2DataClient.RecoverManagedHsmKey(HsmName, Name);
                }

                WriteObject(recoveredKey);
            }
        }
Пример #40
0
        public override void ExecuteCmdlet()
        {
            if (ShouldProcess(AccountName, Properties.Resources.SetManagedStorageAccountKeysAttribute))
            {
                var managedStorageAccount = DataServiceClient.UpdateManagedStorageAccount(
                    VaultName,
                    AccountName,
                    ActiveKeyName,
                    AutoRegenerateKey,
                    RegenerationPeriod,
                    new ManagedStorageAccountAttributes(Enable),
                    Tag);

                if (PassThru)
                {
                    WriteObject(managedStorageAccount);
                }
            }
        }
        public override void ExecuteCmdlet()
        {
            ManagedStorageAccount managedManagedStorageAccount = null;

            ConfirmAction(
                Force.IsPresent,
                string.Format(
                    CultureInfo.InvariantCulture,
                    KeyVaultProperties.Resources.RemoveManagedStorageAccountWarning,
                    AccountName),
                KeyVaultProperties.Resources.RemoveManagedStorageAccountWhatIfMessage,
                AccountName,
                () => { managedManagedStorageAccount = DataServiceClient.DeleteManagedStorageAccount(VaultName, AccountName); });

            if (PassThru)
            {
                WriteObject(managedManagedStorageAccount);
            }
        }
 public InvoiceStatusViewModel()
 {
     try
     {
         if (pxy == null)
         {
             pxy = new DataServiceClient();
         }
         cmdCategory = new DelegateCommand <object>(cmdCategory_Execute);
         lstStatus   = new ObservableCollection <Lookup>();
         lstStatus   = pxy.GetSubLookupList(Const.InvoiceStatus);
         lstStatus.Add(new Lookup {
             ID = 0, Name = "--ALL--"
         });
         lstVendor = new ObservableCollection <VendorMaster>();
         lstVendor = pxy.GetVendorList();
         lstVendor.Add(new VendorMaster {
             ID = 0, Name = "--ALL--"
         });
         lstCategory = new ObservableCollection <Category>();
         lstCategory = pxy.GetCategoryList();
         lstCategory.Add(new Category {
             CategoryID = 0, Name = "--ALL--"
         });
         lstGroup = new ObservableCollection <Lookup>();
         lstGroup = pxy.GetSubLookupList(Const.ProductGroup);
         lstGroup.Add(new Lookup {
             ID = 0, Name = "--ALL--"
         });
         lstSubCategory = new ObservableCollection <SubCategory>
         {
             new SubCategory {
                 SubCategoryID = 0, CategoryID = 0, Name = "--ALL--"
             }
         };
         cmdView         = new DelegateCommand <object>(cmdView_Execute);
         fromInvoiceDate = toInvoiceDate = DateTime.Now.Date;
     }
     catch (FaultException ex)
     {
         UIHelper.ShowErrorMessage(ex.Message);
     }
 }
        public override void ExecuteCmdlet()
        {
            if (InputObject != null)
            {
                VaultName   = InputObject.VaultName;
                AccountName = InputObject.AccountName;
            }

            if (InRemovedState.IsPresent)
            {
                ConfirmAction(
                    Force.IsPresent,
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.RemoveDeletedManagedStorageAccountWarning,
                        AccountName),
                    string.Format(
                        CultureInfo.InvariantCulture,
                        Resources.RemoveDeletedManagedStorageAccountWhatIfMessage,
                        AccountName),
                    AccountName,
                    () => { DataServiceClient.PurgeManagedStorageAccount(VaultName, AccountName); });

                return;
            }

            PSDeletedKeyVaultManagedStorageAccount managedManagedStorageAccount = null;

            ConfirmAction(
                Force.IsPresent,
                string.Format(
                    CultureInfo.InvariantCulture,
                    KeyVaultProperties.Resources.RemoveManagedStorageAccountWarning,
                    AccountName),
                KeyVaultProperties.Resources.RemoveManagedStorageAccountWhatIfMessage,
                AccountName,
                () => { managedManagedStorageAccount = DataServiceClient.DeleteManagedStorageAccount(VaultName, AccountName); });

            if (PassThru)
            {
                WriteObject(managedManagedStorageAccount);
            }
        }
Пример #44
0
        public override void ExecuteCmdlet()
        {
            try
            {
                KeyAttributes attributes = new KeyAttributes
                {
                    Enabled   = this.Enable,
                    Expires   = this.Expires,
                    NotBefore = this.NotBefore,
                    KeyOps    = this.KeyOps
                };

                WriteObject(DataServiceClient.SetKey(VaultName, Name, attributes));
            }
            catch (Exception ex)
            {
                this.WriteErrorDetails(ex);
            }
        }
Пример #45
0
        public static string SelectHoName(int iso, int ho_id)
        {
            #region SQL

            const string SQL = @"select ho_id, ho_iso_id, ho_name from headoffice
                            where ho_iso_id = @iso_id and ho_id = @id;";

            #endregion

            using (var comm = new SqlCommand(SQL))
            {
                comm.Parameters.AddWithValue("@iso_id", iso);
                comm.Parameters.AddWithValue("@id", ho_id);
                var data = comm.CreateSerializationData().ToList().ToArray();
                DataServiceClient client = new DataServiceClient();
                var result = client.TRSExecuteScalar(data);
                return(result.Cast <string>("na"));
            }
        }
Пример #46
0
        private Payload AddAlarmMetrics(Ppuplink.AlarmMessage alarmMessage, Payload payload, PowerPilotCommon.Models.PostgreSQL.Connection connection)
        {
            var phaseID = GetPhase(alarmMessage.Phaseid, connection).ToString();

            if (alarmMessage == null)
            {
                // DBIRTH
                var timestamp = (ulong)DataServiceClient.ConvertToTimestamp(DateTime.Now);
                payload.Metrics.Add(GetMetricInt(Alarm.TYPE, phaseID, Alarm.POWER_FAIL, null, timestamp));
                payload.Metrics.Add(GetMetricDouble(Alarm.TYPE, phaseID, Alarm.VOLTAGE_HIGH, null, timestamp));
                payload.Metrics.Add(GetMetricDouble(Alarm.TYPE, phaseID, Alarm.VOLTAGE_LOW, null, timestamp));
                payload.Metrics.Add(GetMetricDouble(Alarm.TYPE, phaseID, Alarm.VOLTAGE_NORMAL, null, timestamp));

                return(payload);
            }

            switch (alarmMessage.Alarmtype)
            {
            case "powerfailalarm":
                payload.Metrics.Add(GetMetricInt(Alarm.TYPE, phaseID, Alarm.POWER_FAIL, 0, alarmMessage.Timesent));
                break;

            case "highvoltagealarm":
            case "veryhighvoltagealarm":
                payload.Metrics.Add(GetMetricDouble(Alarm.TYPE, phaseID, Alarm.VOLTAGE_HIGH, alarmMessage.Value, alarmMessage.Timesent));
                break;

            case "lowvoltagealarm":
            case "verylowvoltagealarm":
                payload.Metrics.Add(GetMetricDouble(Alarm.TYPE, phaseID, Alarm.VOLTAGE_LOW, alarmMessage.Value, alarmMessage.Timesent));
                break;

            case "normalvoltage":
                payload.Metrics.Add(GetMetricDouble(Alarm.TYPE, phaseID, Alarm.VOLTAGE_NORMAL, alarmMessage.Value, alarmMessage.Timesent));
                break;

            default:
                throw new Exception($"Unhandled alarm type {alarmMessage.Alarmtype}");
            }

            return(payload);
        }
Пример #47
0
 public InvoiceViewModel(int PageMode)
 {
     try
     {
         Mode = PageMode;
         if (pxy == null)
         {
             pxy = new DataServiceClient();
         }
         objInvoiceMaster  = new InvoiceMaster();
         lstStatus         = new ObservableCollection <Lookup>();
         lstInvoiceProduct = new ObservableCollection <InvoiceProduct>();
         lstVendor         = new ObservableCollection <VendorMaster>();
         lstProduct        = new ObservableCollection <ProductList>();
         lstSearch         = new ObservableCollection <Search>
         {
             new Search {
                 ID = 1, Desc = "InvoiceNo"
             },
             new Search {
                 ID = 2, Desc = "OrderID"
             }
         };
         searchMode = 2;
         lstVendor  = pxy.GetVendorList();
         lstProduct = pxy.GetProductList();
         lstStatus  = pxy.GetSubLookupList(Const.InvoiceStatus);
         cmdSearch  = new DelegateCommand <object>(cmdSearch_Execute, cmdSearch_CanExecute);
         cmdSave    = new DelegateCommand <object>(cmdSave_Execute, cmdSave_CanExecute);
         cmdClear   = new DelegateCommand <object>(cmdClear_Execute);
         cmdAdd     = new DelegateCommand <object>(cmdAdd_Execute, canExecute);
         cmdDelete  = new DelegateCommand <object>(cmdDelete_Execute, canExecute);
         cmdGST     = new DelegateCommand <object>(cmdGST_Execute);
         ModeAction();
         IsCSGST = false;
         IsIGST  = false;
     }
     catch (FaultException ex)
     {
         UIHelper.ShowErrorMessage(ex.Message);
     }
 }
Пример #48
0
 private void OnSaveExecute()
 {
     Busy       = true;
     dataClient = ContainerProvider.GetInstance.Resolve <DataServiceClient>();
     if (Worker == null)
     {
         Worker = new WorkerDetail()
         {
             Description   = Description,
             DetachmentID  = LoginInit.user.DetachmentID,
             FirstName     = FirstName,
             LastName      = LastName,
             PersonalEmail = PersonalEmail,
             PersonalPhone = PersonalPhone,
             SapNumber     = SapNumber,
             ServiceEmail  = ServiceEmail,
             ServiceNumber = ServiceNumber,
             ServicePhone  = ServicePhone,
             Tours         = WorkerTours
         };
         dataClient.AddWorkerCompleted += AddWorkerCompleted;
         dataClient.AddWorkerAsync(Worker);
     }
     else
     {
         update               = true;
         Worker.Description   = Description;
         Worker.PersonalEmail = PersonalEmail;
         Worker.PersonalPhone = PersonalPhone;
         Worker.ServiceEmail  = ServiceEmail;
         Worker.ServicePhone  = ServicePhone;
         Worker.Tours         = WorkerTours;
         var w     = SelectedWorker;
         var index = Workers.IndexOf(SelectedWorker);
         Workers.Remove(SelectedWorker);
         w.ServicePhone = ServicePhone;
         Workers.Insert(index, w);
         SelectedWorker = w;
         dataClient.UpdateWorkerCompleted += UpdateWorkerCompleted;
         dataClient.UpdateWorkerAsync(Worker);
     }
 }
Пример #49
0
        public HomeWindowViewModel()
        {
            if (pxy == null)
            {
                pxy = new DataServiceClient();
            }
            lstMenuMaster = new ObservableCollection <Models.MenuMaster>();
            lstScreen     = new ObservableCollection <Lookup>(GetScreenList());
            GetMenuData();

            cmdClose  = new DelegateCommand <object>(cmdClose_execute);
            cmdAddTab = new DelegateCommand <object>(cmdAddTab_execute);
            lstTab    = new ObservableCollection <TabList>();

            cmdRefresh    = new DelegateCommand <object>(cmdRefresh_execute);
            cmdNavigation = new DelegateCommand <object>(cmdNavigation_execute);
            cmdExit       = new DelegateCommand <object>(cmdExit_execute);

            cmdPageMode = new DelegateCommand <object>(cmdPageMode_execute);
        }
Пример #50
0
        private Payload AddUplinkMetrics(Ppuplink.UplinkMessage uplinkMessage, Payload payload)
        {
            ulong timestamp;

            if (uplinkMessage == null)
            {
                timestamp = (ulong)DataServiceClient.ConvertToTimestamp(DateTime.Now);
            }
            else
            {
                timestamp = uplinkMessage.Timesent;
            }

            payload.Metrics.Add(GetMetricInt(Uplink.TYPE, "", Uplink.RSSI, (uint?)uplinkMessage?.Rssi, timestamp));
            payload.Metrics.Add(GetMetricInt(Uplink.TYPE, "", Uplink.SNR, (uint?)uplinkMessage?.Snr, timestamp));
            payload.Metrics.Add(GetMetricLong(Uplink.TYPE, "", Uplink.FREQ, uplinkMessage?.Frequency, timestamp));
            payload.Metrics.Add(GetMetricInt(Uplink.TYPE, "", Uplink.DR, (uint?)uplinkMessage?.Dr, timestamp));

            return(payload);
        }
Пример #51
0
 //
 // GET: /Application/
 public async Task<ActionResult> Applicant(int id = -1)
 {
     AESManagement.AESDataService.ApplicantApp model = new AESManagement.AESDataService.ApplicantApp();
     if (id != -1)
     {
         using (DataServiceClient client = new DataServiceClient())
         {
             if (Session["_Locked"] != null)
             {
                 await client.unlockAppAsync((int)Session["_Locked"]);
             }
             await client.lockAppAsync(id);
             model = await client.getApplicationAsync(id);
             Session["_Locked"] = id;
         }
         return View(model);
     }
     else
         return View(model);
 }
Пример #52
0
 public VendorViewModel(int PageMode)
 {
     try
     {
         Mode = PageMode;
         if (pxy == null)
         {
             pxy = new DataServiceClient();
         }
         objVendorMaster  = new VendorMaster();
         cmdVendorDetails = new DelegateCommand <object>(cmdVendorDetails_Execute, cmdVendorDetails_CanExecute);
         cmdSave          = new DelegateCommand <object>(cmdSave_Execute, cmdSave_CanExecute);
         cmdClear         = new DelegateCommand <object>(cmdClear_Execute);
         ModeAction();
     }
     catch (FaultException ex)
     {
         UIHelper.ShowErrorMessage(ex.Message);
     }
 }
 public CreateChangeoverViewModel(DataServiceClient dataClient, CreateChangeoverViewModelValidator validator, INavigator navigator)
 {
     Busy            = true;
     Enabled         = true;
     busyCount       = 1;
     this.dataClient = dataClient;
     this.validator  = validator;
     Navigator       = navigator;
     Date            = Navigator.Parameters.Date;
     TopFaultWorks   = Navigator.Parameters.TopFaultWorks;
     InitCommands();
     this.dataClient.FindVehiclesCompleted += FindVehiclesCompleted;
     this.dataClient.FindVehiclesAsync(LoginInit.user.DetachmentID);
     this.dataClient.FindWorkTypesCompleted += FindWorkTypesCompleted;
     this.dataClient.FindWorkTypesAsync(LoginInit.user.DetachmentID);
     PropertyChanged += (s, e) =>
     {
         (CreateCommand as Command).OnCanExecuteChanged();
     };
 }
Пример #54
0
        public BcontrolDataHandler(MainPage page)
        {
            _service = new DataServiceClient("BasicHttpBinding_IDataService", Constants.InitParams.BcontrolDataServiceURL(page));
            MapsInBcontrol = new List<string>();
            _service.GetSearchInitialDataCompleted += new EventHandler<GetSearchInitialDataCompletedEventArgs>(CallbackSearchInitialDataCompleted);
            _service.GetSearchMapListCompleted += new EventHandler<GetSearchMapListCompletedEventArgs>(CallbackSearchByMapDataRetrieved);
            _service.GetSearchGlobalHeadListCompleted += new EventHandler<GetSearchGlobalHeadListCompletedEventArgs>(CallbackSearchByGlobalHeadDataRetrieved);
            _service.GetSearchGlobalFunctionListCompleted += new EventHandler<GetSearchGlobalFunctionListCompletedEventArgs>(CallbackSearchByGlobalFunctionDataRetrieved);
            _service.GetSearchBusinessAreaListCompleted += new EventHandler<GetSearchBusinessAreaListCompletedEventArgs>(CallbackSearchByBusinessAreaDataRetrieved);
            _service.GetSearchBusinessFunctionListCompleted += new EventHandler<GetSearchBusinessFunctionListCompletedEventArgs>(CallbackSearchByBusinessFunctionDataRetrieved);
            _service.GetSearchSubFunctionListCompleted += new EventHandler<GetSearchSubFunctionListCompletedEventArgs>(CallbackSearchBySubFunctionDataRetrieved);

            _service.GetSearchResultsBylevelCompleted += new EventHandler<GetSearchResultsBylevelCompletedEventArgs>(CallbackSearchByLevelDataRetrieved);
            _service.GetSearchResultsByHierarchyCompleted += new EventHandler<GetSearchResultsByHierarchyCompletedEventArgs>(CallbackSearchByHierarchyDataRetrieved);
            _service.GetDiagramTemplateLinkCompleted += new EventHandler<GetDiagramTemplateLinkCompletedEventArgs>(CallbackDiagramTemplateLinkRetrieved);            
            _service.GetExisitingActivitiesCompleted +=new EventHandler<GetExisitingActivitiesCompletedEventArgs>(CallbackExisitingActivitiesCompleted); 
            _service.ClearBcontrolHierarchyDataCompleted +=new EventHandler<ClearBcontrolHierarchyDataCompletedEventArgs>(CallBackClearBcontrolHierarchyDataCompleted);
            _service.AddBcontrolHierarchyDataCompleted += new EventHandler<AddBcontrolHierarchyDataCompletedEventArgs>(CallBackAddBcontrolHierarchyDataCompleted);
            _service.CompleteAddBcontrolHierarchyDataCompleted += new EventHandler<CompleteAddBcontrolHierarchyDataCompletedEventArgs>(CallBackCompleteAddBcontrolHierarchyDataCompleted);
        }
Пример #55
0
 private void OnAddExecute()
 {
     Busy = true;
     selectedAttendance = new Attendance()
     {
         DateID        = Date.ID,
         Description   = Description,
         FirstName     = FirstName,
         LastName      = LastName,
         SapNumber     = Worker.SapNumber,
         WorkerID      = Worker.ID,
         WorkerState   = SelectedWorkerState.Name,
         WorkerStateID = SelectedWorkerState.ID,
         WorkerTour    = SelectedWorkerTour.StartTime.ToString() + " - " + SelectedWorkerTour.EndTime.ToString(),
         WorkerTourID  = SelectedWorkerTour.ID
     };
     dataClient = ContainerProvider.GetInstance.Resolve <DataServiceClient>();
     dataClient.AddAttendanceCompleted += AddAttendanceCompleted;
     dataClient.AddAttendanceAsync(selectedAttendance);
 }
Пример #56
0
        public static ResponseMessage Execute(this DataServiceClient client, RequestMessage requestMessage, string productName)
        {
            client.ShouldNotBeNull("client");
            requestMessage.ShouldNotBeNull("requestMessage");

            try {
                var requestBytes  = ResolveRequestSerializer(productName).Serialize(requestMessage);
                var responseBytes = client.Execute(requestBytes, productName);

                return(ResolveResponseSerializer(productName).Deserialize(responseBytes));
            }
            catch (Exception ex) {
                if (log.IsErrorEnabled)
                {
                    log.ErrorException("WCF DataServiceClient를 통한 요청이 실패했습니다.", ex);
                }

                throw;
            }
        }
Пример #57
0
        /// <summary>
        /// Loads the project asynchronously.
        /// </summary>
        /// <param name="projectUri">The project URI.</param>
        public void LoadProjectAsync(Uri projectUri)
        {
            this.OnLoadProjectCompleted(new DataEventArgs <Project>(null, null));

            if (projectUri == null)
            {
                return;
            }

            DataServiceClient client = this.CreateDataServiceClient();

            client.LoadProjectCompleted += (sender, args) =>
            {
                if (args.Error != null)
                {
                    client.Abort();
                    this.logger.Log(this.GetType().Name, args.Error);

                    if (args.Error.GetType() == typeof(Exception))
                    {
                        throw args.Error;
                    }

                    return;
                }

                try
                {
                    Project project = DataServiceTranslator.ConvertToProject(args.Result);
                    this.OnLoadProjectCompleted(new DataEventArgs <Project>(project));
                }
                catch (Exception e)
                {
                    client.Abort();
                    this.logger.Log(this.GetType().Name, e);
                    throw;
                }
            };

            client.LoadProjectAsync(projectUri);
        }
 public async Task<ActionResult> Index(List<EducationModel> model)
 {
     if (ModelState.IsValid)
     {
         bool educationStored = false;
         using (var client = new DataServiceClient())
         {
             client.Open();
             var education = new List<Education>();
             foreach (var ed in model)
             {
                 var temp = new Education();
                 temp.applicantId = Convert.ToInt32(this.Session["ApplicantId"]);
                 temp.degreeMajor = ed.degree;
                 temp.graduatedYN = ed.graduated;
                 temp.street = ed.street;
                 temp.city = ed.city;
                 temp.stateAbrev = ed.state;
                 temp.zip = ed.zip;
                 temp.name = ed.name;
                 temp.yearFrom = ed.yearFrom;
                 temp.yearTo = ed.yearTo;
                 temp.applicantId = ed.applicantId;
                 temp.educationId = ed.educationId;
                 education.Add(temp);
             }
             educationStored = await client.updateEducationsAsync(education.ToArray());
             client.Close();
         }
         if (educationStored)
         {
             this.Session["Education"] = "Done";
             return RedirectToAction("Index", "References");
         }
         else
         {
             //error occured storing education 
         }
     }
     return View(model);
 }
Пример #59
0
        public void GetAuthorisationDestination()
        {
            SourceCode.SmartObjects.Services.ServiceSDK.Objects.ServiceObject serviceObject = Service.ServiceObjects[0];
            string dataCollector = GetMandatoryServiceObjectProperty(serviceObject, "DataCollector").ToString();

            Dictionary<string, object> properties = new Dictionary<string, object>();
            properties.Add("claimTransactionHeaderId", GetMandatoryServiceObjectProperty(serviceObject, "ClaimTransactionHeaderID"));
            properties.Add("creatorUserIdentity", GetMandatoryServiceObjectProperty(serviceObject, "CurrentUserIdentity"));

            if (_Logger.IsDebugEnabled)
            {
                _Logger.Debug(string.Format("GetAuthorisationDestination({0}, {1})", properties["claimTransactionHeaderId"], properties["creatorUserIdentity"]));
            }

            DataServiceClient client = null;
            try
            {
                client = new DataServiceClient();
                XElement response = client.GetData(dataCollector, properties);
                string destinationType = response.Attribute("DestinationType").Value;
                string destinationName = response.Attribute("DestinationName").Value;

                if (_Logger.IsDebugEnabled)
                {
                    _Logger.Debug(string.Format("GetAuthorisationDestination({0}, {1}) => name: {2}, type: {3}", properties["claimTransactionHeaderId"], properties["creatorUserIdentity"], destinationType, destinationName));
                }

                serviceObject.Properties.InitResultTable();
                serviceObject.Properties["DestinationType"].Value = destinationType;
                serviceObject.Properties["DestinationName"].Value = destinationName;
                serviceObject.Properties.BindPropertiesToResultTable();
            }
            finally
            {
                if (client != null && client.State == System.ServiceModel.CommunicationState.Opened)
                {
                    client.Close();
                }
            }
        }
 public async Task<ActionResult> Index(AuthenticationModel model)
 {
     if (ModelState.IsValid)
     {
         using (var client = new DataServiceClient())
         {
             int authenticated = await client.authenticateUserAsync(model.ssn, model.password);
             if (authenticated > 0)
             {
                 Session["ApplicantId"] = authenticated;
                 Session["Status"] = "LoggedIn";
                 Session["PersonalInfo"] = "Done";
                 return RedirectToAction("Index", "PersonalInfo");
             }
             else
             {
                 ModelState.AddModelError("password", "User name or password does not match.");
             }
         }
     }
     return View(model);
 }