public ProcResult UpdateUserLastLoginDate(int id) { ProcResult result = new ProcResult(); try { var user = _context.MTLoginMasters.Where(x => x.UserId == id).FirstOrDefault(); if (user != null) { user.LastLogin = DateTime.Now; _context.SaveChanges(); result.ErrorID = 0; result.strResult = "User Last Login Updated successfully !"; } else { result.ErrorID = 1; result.strResult = "No User found !"; } } catch (Exception ex) { result.ErrorID = 1; result.strResult = ex.Message; } return(result); }
/// <summary> /// Method responsible for inserting a member in database /// </summary> /// <typeparam name="T">Entity type</typeparam> /// <param name="entity"></param> /// <returns></returns> public ProcResult Insert <T>(T entity) where T : class { ProcResult proc = new ProcResult(); proc.Success = true; proc.Message = Messages.ExecuteSuccess.ToString(); using (var context = new eManageContext()) { try { context.Entry(entity).State = EntityState.Added; context.SaveChanges(); proc.objResult = entity; } catch (Exception ex) { proc.Success = false; proc.Message = ex.Message.ToString(); } } return(proc); }
public RPMSync(string apiUrl, string apiKey) { this.rpmApiUrl = apiUrl; this.rpmApiKey = apiKey; this.syncDataWorker.WorkerReportsProgress = true; this.syncDataWorker.DoWork += syncData; this.syncDataWorker.RunWorkerCompleted += syncingComplete; this.syncDataWorker.ProgressChanged += syncingProgressChanged; this.checkRPMAccess(); if (this.infoSuccessful()) { ProcsResult procs = this.getAllProcs(); this.jobProcess = this.getProc("External-JobInformation", procs); if (this.jobProcess == null) { throw new ProcessNotFoundException("The RPM Process \"External-JobInformation\" was not Found."); } if (!this.jobProcess.Enabled) { RPMApiError error = new RPMApiError(); error.Error = new Dictionary <string, string> { { "Message", "The RPM Process \"External-JobInformation\" is not enabled." } }; throw error; } } }
public ProcResult updateLoginStatus(int Id, int status) { ProcResult result = new ProcResult(); try { var user = _context.MTLoginMasters.Where(x => x.UserId == Id).FirstOrDefault(); if (user != null) { user.IsLogin = status; _context.SaveChanges(); result.ErrorID = 0; result.strResult = "User Login Status Updated successfully !"; } else { result.ErrorID = 1; result.strResult = "User Login Status Failed!"; } } catch (Exception ex) { result.ErrorID = 1; result.strResult = ex.Message; } return(result); }
/* * Using Entityframework developed on Code First, which was desined its methods dinamicly to support any table. */ /// <summary> /// Method responsible for executing a store procedure from database /// </summary> /// <param name="proc"></param> /// <returns></returns> public ProcResult ExecProc(ProcResult proc) { proc.Success = true; proc.Message = Messages.ExecuteSuccess.ToString(); try { using (var context = new eManageContext()) { if (proc.Parameters == null || proc.Parameters.Count() == 0) { context.Database.ExecuteSqlCommand(proc.ProcName); } else { context.Database.ExecuteSqlCommand(proc.ProcName, proc.Parameters); } } } catch (Exception ex) { proc.Success = false; proc.Message = ex.Message.ToString(); } return(proc); }
private void synchronizeJobInformation(ProcResult jobProc) { Dictionary <string, ProcForm> forms = this.byExternalJobID(jobProc.ProcessID, this.getListOfForms(jobProc.ProcessID)); int jobCount = googleData.Count; int current = 0; foreach (string jobId in googleData.Keys) { string description = googleData[jobId].Description; string location = googleData[jobId].Location; if (forms.ContainsKey(jobId)) { ProcForm form = forms[jobId]; if (form.valueForField("Job Description") != description || form.valueForField("Job Location") != location) { this.updateJobForm(forms[jobId], description, location); } } else { this.createJobForm(jobProc.ProcessID, jobId, description, location); } current += 1; forms.Remove(jobId); this.syncDataWorker.ReportProgress(current * 100 / jobCount); } foreach (string deletedJobId in forms.Keys) { ProcForm form = forms[deletedJobId]; this.updateJobForm(form, form.valueForField("Job Description"), form.valueForField("Job Location"), true); } }
/// <summary> /// Zápis do logovací tabulky AppLogNew /// </summary> /// <param name="authToken"></param> /// <param name="type"></param> /// <param name="message"></param> /// <param name="xmlDeclaration"></param> /// <param name="xmlMessage"></param> /// <param name="zicyzUserId"></param> /// <param name="sourceName"></param> /// <returns></returns> public static SubmitDataToProcessingResult AppLogWrite(AuthToken authToken, string type, string message, string xmlDeclaration, string xmlMessage, int zicyzUserId, string sourceName) { SubmitDataToProcessingResult result = new SubmitDataToProcessingResult(); try { if (authToken != null) { FenixAppSvcClient appClient = new FenixAppSvcClient(); appClient.AuthToken = new Fenix.WebService.Service_References.FenixAppService.AuthToken() { Value = authToken.Value }; ProcResult procResult = appClient.AppLogWriteNew(type, message, xmlDeclaration, xmlMessage, zicyzUserId, sourceName); appClient.Close(); if (procResult.ReturnValue == (int)BC.OK) { CreateOkResult(ref result); } else { CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "90", procResult.ReturnMessage); } } } catch (Exception ex) { CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "100", ex); } return(result); }
public static void UpdateGGView(ProcResult result, UpdateGaVm ugvm) { //ugvm.GraphLatticeTempVm.Update(result.Data["ThermGrid"]); //ugvm.GraphLatticeFlipVm.Update(result.Data["FlipGrid"]); //var th = (float)result.Data["TotalHeat"]; //ugvm.TotalHeat = th; }
public ProcResult Edit(SysDictionary model, long currentOperator) { ProcResult result = new ProcResult(); try { var entity = GetModelById(model.ID); if (entity != null) { entity.Name = model.Name; entity.Type = model.Type; entity.Reserve = model.Reserve; entity.Auditor = model.Auditor; entity.AuditTime = model.AuditTime; entity.Canceler = model.Canceler; entity.CancelTime = model.CancelTime; entity.Remark = model.Remark; entity.Creator = currentOperator; entity.CreateTime = DateTime.Now; } db.Entry <SysDictionary>((SysDictionary)entity).State = System.Data.Entity.EntityState.Modified; result.IsSuccess = db.SaveChanges() > 0; } catch (Exception ex) { result.ProcMsg = ex.InnerException.Message; LogUtil.Exception("ExceptionLogger", ex); } return(result); }
public ProcResult UpdateRemark(Remark remark) { ProcResult res = new ProcResult(); Remark obj = new Remark(); try { obj = _context.Remarks.Find(remark.OrderId); obj.EID = remark.EID; obj.EIDDate = remark.EIDDate; obj.OrderId = remark.OrderId; obj.Comment = remark.Comment; obj.Id = remark.Id; obj = remark; obj.UID = remark.UID; obj.UIDDate = remark.UIDDate; _context.SaveChanges(); res.ErrorID = 0; res.strResult = "Remark Updated Sucessfully"; } catch { res.ErrorID = 1; res.strResult = "Remark Update Failed"; } return(res); }
void KeepUpdating(ProcResult result) { smidgeX = (_betaMax - _betaMin) / 500; smidgeY = (_eMax - _eMin) / 500; var boundingRect = new R <float>(_betaMin, _betaMax, 1.8f, 2.7f); Energy = (float)result.Data["Energy"]; GraphVm.WbImageVm.ImageData = Id.AddRect( GraphVm.WbImageVm.ImageData, new RV <float, Color>( minX: BetaLow, maxX: BetaLow + smidgeX, minY: Energy, maxY: Energy + smidgeY, v: Colors.Red )); GraphVm.WbImageVm.ImageData = Id.AddRect( GraphVm.WbImageVm.ImageData, new RV <float, Color>( minX: BetaHigh, maxX: BetaHigh + smidgeX, minY: Energy, maxY: Energy + smidgeY, v: Colors.Blue )); GraphLatticeVm.Update(result.Data["Grid"]); SetBeta(); _updateUI.OnNext(result); }
void UpdateUI(ProcResult result) { TotalSteps += result.StepsCompleted; Time += (result.TimeInMs / 1000); ErrorMsg = result.ErrorMsg; _updateUI.OnNext(result); }
/// <summary> /// Volání SP pro ověření 'zdraví služeb' /// </summary> /// <param name="authToken"></param> /// <param name="login"></param> /// <param name="password"></param> /// <param name="partnerCode"></param> /// <param name="messageType"></param> /// <returns>result.MessageDescription by měla obsahovat string 'Automat Rows : 1 | DateTime : yyyy-mm-dd hh:mi:ss.mmm'</returns> public static SubmitDataToProcessingResult Process(AuthToken authToken, string login, string password, string partnerCode, string messageType) { SubmitDataToProcessingResult result = new SubmitDataToProcessingResult(); try { if (authToken != null) { FenixAppSvcClient appClient = new FenixAppSvcClient(); appClient.AuthToken = new Fenix.WebService.Service_References.FenixAppService.AuthToken() { Value = authToken.Value }; ProcResult procResult = appClient.GetServicesStatuses(BC.ZICYZ_USER_ID); appClient.Close(); if (procResult.ReturnValue == (int)BC.OK) { result.MessageDescription = procResult.ReturnMessage; } else { ProjectHelper.CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "90", procResult.ReturnMessage); } } } catch (Exception ex) { ProjectHelper.CreateErrorResult(ApplicationLog.GetMethodName(), ref result, "100", ex); } return(result); }
public void SetStatusAndResult(ProcessStatus status, ProcResult result) { if (this.Status != ProcessStatus.Finished) { this.Status = status; this.Result = result; } }
private static ProcResult DoProcess(FenixAppSvcClient appClient, string xmlString, string messageType) { ProcResult procResult = new ProcResult(); string messageTypeNormalized = messageType.ToUpper().Trim(); switch (messageTypeNormalized) { case "RECEPTIONCONFIRMATION": procResult = appClient.ReceptionConfirmationProcess(xmlString, BC.ZICYZ_USER_ID); break; case "KITTINGCONFIRMATION": procResult = appClient.KittingConfirmationProcess(xmlString, BC.ZICYZ_USER_ID); break; case "SHIPMENTCONFIRMATION": procResult = appClient.ShipmentConfirmationProcess(xmlString, BC.ZICYZ_USER_ID); break; case "RETURNED": case "RETURNEDEQUIPMENT": procResult = appClient.ReturnedEquipmentProcess(xmlString, BC.ZICYZ_USER_ID); break; case "RETURNEDITEM": procResult = appClient.ReturnedItemProcess(xmlString, BC.ZICYZ_USER_ID); break; case "RETURNEDSHIPMENT": procResult = appClient.ReturnedShipmentProcess(xmlString, BC.ZICYZ_USER_ID); break; case "REFURBISHEDCONFIRMATION": procResult = appClient.RefurbishedConfirmationProcess(xmlString, BC.ZICYZ_USER_ID); break; case "DELETEMESSAGECONFIRMATION": procResult = appClient.DeleteMessageConfirmationProcess(xmlString, BC.ZICYZ_USER_ID); break; case "CRMORDERCONFIRMATION": procResult = appClient.CrmOrderConfirmationProcess(xmlString, BC.ZICYZ_USER_ID); break; case "CRMORDERAPPROVAL": procResult = appClient.CrmOrderApprovalProcess(xmlString, BC.ZICYZ_USER_ID); break; default: procResult.ReturnValue = (int)BC.NOT_OK; procResult.ReturnMessage = String.Format("Unknown messageType = [{0}]", messageType); break; } return(procResult); }
void KeepUpdating(ProcResult result) { _updateUI.OnNext(result); GaSortingData = result.Data.GetGaSortingData(); var seq = GaSortingData.Data.GetSortablePool().Sortables.Values.First().GetMap(); Message = StringFuncs.LineFormat(seq); Report.Add($"{GaSortingData.Data.GetCurrentStep()}\t{GaSortingData.Report()}"); }
/// <summary> /// Step2 「パネルセット」 /// </summary> /// <returns>継続/エラー/終了</returns> ProcResult Proc_SetPanel() { // 画面に「パネルセット」状態を設定 SetStep(InspectionStep.SetPanel); // 画面の処理終了待ち ProcResult pret = WaitFinish(); return(pret); }
public ProcResult Changerole(int id, MTLoginMaster user) { ProcResult r = new ProcResult(); ObjectParameter objE = new ObjectParameter("ipiErrorID", typeof(int)); ObjectParameter objR = new ObjectParameter("ipvResult", typeof(string)); _context.UserMaster((byte)Flag.Update, user.UserId, user.ImageUrl, user.UserEmailAddress, user.UserName, user.UserPassword, user.RoleId, user.Flag, 0, objE, objR); r.ErrorID = Convert.ToInt32(objE.Value); r.strResult = Convert.ToString(objR.Value); return(r); }
public AjaxResult AddCorporation(string corpName, long corpType, long @operator, long parentCorp, string loginName, string password) { ProcResult result = sysCorpDal.AddCorporation(corpName, corpType, @operator, parentCorp, loginName, password); return(new AjaxResult() { flag = result.IsSuccess, dateTime = DateTime.Now, message = result.ProcMsg }); }
public ActionResult AddOrder(OrderViewModel model) { model.Date = DateTime.Now.Date; model.AgentName = SessionWrapper.Get <string>(AppConstant.UserName); if (SessionWrapper.Get <int>(AppConstant.RoleId) == 2) { model.CurrentStatus = 1; ModelState.Remove("CurrentStatus"); } if (ModelState.IsValid) { ProcResult rMaster = new ProcResult(); try { if (model.OrderId == 0) { model.EID = SessionWrapper.Get <int>(AppConstant.UserId); model.EIDDate = DateTime.Now; if (model.Comment == null) { model.Comment = "Order Created By: " + SessionWrapper.Get <string>(AppConstant.UserName); } rMaster = _iOrderService.Add(model); } else { model.UID = SessionWrapper.Get <int>(AppConstant.UserId); model.UIDDate = DateTime.Now; rMaster = _iOrderService.Update(model); } if (rMaster.ErrorID == 0) { TempData["Message"] = helper.GenerateMessage(rMaster.strResult, MessageType.Success); } else { TempData["Message"] = helper.GenerateMessage(rMaster.strResult, MessageType.Error); } } catch (Exception ex) { TempData["Message"] = helper.GenerateMessage(ex.Message, MessageType.Error); } return(RedirectToAction("Index")); } else { model.lstOrderStatus = _iDataService.GetOrdersStatus(); model.lstDistricts = _iDataService.GetDistricts(); model.lstProducts = _iDataService.GetProducts(); return(View("NewOrder", model)); } }
/// <summary> /// Step0 「初期化中」 /// </summary> /// <returns>継続/エラー/終了</returns> ProcResult Proc_Intialize() { // 「初期化中」状態 SetStep(InspectionStep.Intialize); Enum devtype; if (!m_devMgr.InitializeAll(out devtype)) { // 機器初期化エラー SetErrorMsg($"機器初期化エラー({devtype})"); return(ProcResult.Error); } if (!m_devMgr.ConnectAll(out devtype)) { // 機器接続エラー SetErrorMsg($"機器接続エラー({devtype})"); return(ProcResult.Error); } // PLCイベント設定 m_devMgr.PLC.DetectError += OnPlcDetectError; m_devMgr.PLC.SignalChanged += OnPlcSetSignal; // PLC開始 if (!m_devMgr.PLC.StartCommunication()) { SetErrorMsg("PLC開始エラー"); return(ProcResult.Error); } // PLCエラー監視タスク開始 m_devMgr.PLC.StartCheckTask(); // パトライト:緑点灯 if (!SetSignalTower(Device.SigType.Green)) { return(ProcResult.Error); } // 設備状態報告。選択したレシピ情報をCIMに通知する if (!UpdateRecipe()) { SetErrorMsg("検査レシピ初期化中エラー"); return(ProcResult.Error); } // 終了待ち ProcResult pret = WaitFinish(); return(pret); }
/// <summary> /// Step5 「表面検査」 /// </summary> /// <returns>継続/エラー/終了</returns> ProcResult Proc_InspectionFront() { // 画面に「搬入」状態を設定 SetStep(InspectionStep.InspectionFront); // パトライト:緑点灯 if (!SetSignalTower(Device.SigType.Green)) { return(ProcResult.Error); } // 画面の処理終了待ち ProcResult pret = WaitFinish(); return(pret); }
public ProcResult Add(TableDownLoad model) { ProcResult result = new ProcResult(); try { db.TableDownLoad.Add(model); result.IsSuccess = db.SaveChanges() > 0; } catch (Exception ex) { result.ProcMsg = ex.InnerException.Message; LogUtil.Exception("ExceptionLogger", ex); } return(result); }
/// <summary> /// Step1 「ID取得」 /// </summary> /// <returns>継続/エラー/終了</returns> ProcResult Proc_GetID() { // 画面に「ID取得」状態を設定 SetStep(InspectionStep.GetId); // パトライト:黄点灯 if (!SetSignalTower(Device.SigType.Yellow)) { return(ProcResult.Error); } // 画面の処理終了待ち ProcResult pret = WaitFinish(); return(pret); }
/// <summary> /// Step4 「パネル反転」 /// </summary> /// <returns>継続/エラー/終了</returns> ProcResult Proc_ReversePanel() { // 画面に「パネル反転」状態を設定 SetStep(InspectionStep.ReversePanel); // パトライト:黄点灯 if (!SetSignalTower(Device.SigType.Yellow)) { return(ProcResult.Error); } // 画面の処理終了待ち ProcResult pret = WaitFinish(); return(pret); }
/// <summary> /// Vlastní zpracování XML message (zrušení deklarační části, zušení všech jmenných prostorů a volání stored procedure na MS SQL) /// </summary> /// <param name="authToken"></param> /// <param name="login"></param> /// <param name="password"></param> /// <param name="partnerCode"></param> /// <param name="messageType"></param> /// <param name="encoding"></param> /// <returns></returns> public static SubmitDataToProcessingResult Process(AuthToken authToken, string login, string password, string partnerCode, string messageType, byte[] data, string encoding) { SubmitDataToProcessingResult result = new SubmitDataToProcessingResult(); string xmlString = String.Empty; try { if (authToken != null) { xmlString = data.ToString(Encoding.GetEncoding(encoding), Encoding.Unicode); xmlString = PrepareXml(xmlString); result = ProjectHelper.AppLogWrite(authToken, "XML", ProjectHelper.CreateAppLogMessage(partnerCode, messageType, "modified XML"), "", xmlString, BC.ZICYZ_USER_ID, Fenix.ApplicationLog.GetMethodName()); if (result.MessageNumber == BC.OK) { FenixAppSvcClient appClient = new FenixAppSvcClient(); appClient.AuthToken = new Fenix.WebService.Service_References.FenixAppService.AuthToken() { Value = authToken.Value }; ProcResult procResult = DoProcess(appClient, xmlString, messageType); appClient.Close(); if (procResult.ReturnValue == (int)BC.OK) { ProjectHelper.CreateOkResult(ref result); } else { ProjectHelper.CreateErrorResult(Fenix.ApplicationLog.GetMethodName(), ref result, "90", procResult.ReturnMessage); } } } } catch (Exception ex) { ProjectHelper.CreateErrorResult(Fenix.ApplicationLog.GetMethodName(), ref result, "100", ex); ProjectHelper.AppLogWrite(authToken, "ERROR", String.Format("Během zpracování XML\n{0}\ndošlo k chybě\n{1}", xmlString, ex.Message), String.Empty, String.Empty, BC.ZICYZ_USER_ID, Fenix.ApplicationLog.GetMethodName()); } return(result); }
public ProcResult Delete(long id) { ProcResult result = new ProcResult(); try { var entity = GetModelById(id); db.SysDictionary.Remove(entity); result.IsSuccess = db.SaveChanges() > 0; } catch (Exception ex) { result.ProcMsg = ex.InnerException.Message; LogUtil.Exception("ExceptionLogger", ex); } return(result); }
public ActionResult AdminAddUser(UserViewModel model) { model.ImageUrl = "UserImages/" + "avatar5.png"; ModelState.Remove("lstRoles"); model.lstRoles = _iDataService.GetRoles(); if (ModelState.IsValid) { ProcResult rMaster = new ProcResult(); try { model.EID = SessionWrapper.Get <int>(AppConstant.UserId); if (!string.IsNullOrEmpty(model.UserPassword)) { model.UserPassword = new UtilityHelper().EncrpytPassword(model.UserPassword); } if (model.UserId == 0) { model.Flag = "A"; rMaster = _iUserService.Save(model); } else { rMaster = _iUserService.Save(model); } if (rMaster.ErrorID == 0) { model = new UserViewModel(); model.lstRoles = _iDataService.GetRoles(); TempData["Message"] = helper.GenerateMessage(rMaster.strResult + " Wait for Admin Approval", MessageType.Success); } else { TempData["Message"] = helper.GenerateMessage(rMaster.strResult, MessageType.Error); } } catch (Exception ex) { TempData["Message"] = helper.GenerateMessage(ex.Message, MessageType.Error); } return(RedirectToAction("Index")); } else { return(View("NewUser", model)); } }
public ActionResult ChangeRole(int id, int roleId) { ProcResult rMaster = new ProcResult(); UserViewModel model = new UserViewModel(); try { model = _iUserService.GetById(id); model.RoleId = roleId; model.EID = SessionWrapper.Get <int>(AppConstant.UserId); rMaster = _iUserService.ChangeRole(id, model); } catch (Exception ex) { } return(RedirectToAction("Index")); }
// GET: DashBoard/Details/5 public ActionResult AccountFlag(int id, string flag) { ProcResult rMaster = new ProcResult(); UserViewModel model = new UserViewModel(); try { model = _iUserService.GetById(id); model.Flag = flag; model.EID = SessionWrapper.Get <int>(AppConstant.UserId); rMaster = _iUserService.ActivateAndDeActivate(id, model); } catch (Exception ex) { } return(RedirectToAction("Index")); }
public EditProcResult( ProcResult EditTarget ) :this() { this.EditTarget = EditTarget; }
public Procedure NewProcedure( ProcType P ) { Procedure Proc = null; switch ( P ) { case ProcType.URLLIST: Proc = new ProcUrlList(); break; case ProcType.FIND: Proc = new ProcFind(); break; case ProcType.GENERATOR: Proc = new ProcGenerator(); break; case ProcType.RESULT: Proc = new ProcResult(); break; case ProcType.CHAKRA: Proc = new ProcChakra(); break; case ProcType.ENCODING: Proc = new ProcEncoding(); break; case ProcType.PARAMETER: Proc = new ProcParameter(); break; case ProcType.EXTRACT: Proc = ProcExtract.Create(); break; case ProcType.MARK: Proc = ProcMark.Create(); break; case ProcType.LIST: Proc = ProcListLoader.Create(); break; } ProcList.Add( Proc ); return Proc; }