public ActionResult Editing_Update([DataSourceRequest] DataSourceRequest request, [Bind(Prefix = "models")] IEnumerable <MasterMobileModel> masterMobiles) { var Client = new MongoClient(constr); var DB = Client.GetDatabase(databaseName); if (masterMobiles != null && ModelState.IsValid) { foreach (var masterMobile in masterMobiles) { var collection = DB.GetCollection <MasterMobileModel>("tMasterMobile"); var filter = Builders <MasterMobileModel> .Filter.Eq("id", masterMobile.id); masterMobile.uptAt = GlobalFunctions.GetIPAddress(); masterMobile.uptBy = "User"; masterMobile.uptOn = DateTime.Now; var set = Builders <MasterMobileModel> .Update .Set("id", masterMobile.id) .Set("mstMblNo", masterMobile.mstMblNo) .Set("mstMblCtrCd", masterMobile.mstMblCtrCd) .Set("mstPosCode", masterMobile.mstPosCode) .Set("otpMode", masterMobile.otpMode) .Set("act", masterMobile.act) .Set("otp", masterMobile.otp) .Set("email", masterMobile.email) .Set("expired", masterMobile.expired) .Set("shnEndDate", masterMobile.shnEndDate) .Set("uptOn", masterMobile.uptOn) .Set("uptAt", masterMobile.uptAt) .Set("uptBy", masterMobile.uptBy); collection.FindOneAndUpdateAsync(filter, set); } } return(Json(masterMobiles.ToDataSourceResult(request, ModelState))); }
public void KojtoCAD_3D_Clear_ExplicitCuttingMethodForEndsOf3D_Bends() { Database db = HostApplicationServices.WorkingDatabase; Editor ed = Application.DocumentManager.MdiActiveDocument.Editor; if ((container != null) && (container.Bends.Count > 0) && (container.Triangles.Count > 0)) { PromptKeywordOptions pop = new PromptKeywordOptions(""); pop.AppendKeywordsToMessage = true; pop.AllowNone = false; pop.Keywords.Add("Run"); pop.Keywords.Add("Help"); pop.Keywords.Default = "Run"; PromptResult res = ed.GetKeywords(pop); if (res.Status == PromptStatus.OK) { switch (res.StringResult) { case "Run": foreach (WorkClasses.Node Node in container.Nodes) { Node.ExplicitCuttingMethodForEndsOf3D_Bends = -1; } break; case "Help": GlobalFunctions.OpenHelpHTML("http://3dsoft.blob.core.windows.net/kojtocad/html/CUTTING_BENDS_IN_NODES.htm"); break; } } } else { MessageBox.Show("\nData Base Empty !\n\nMissing Bends !", "Range Error !", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private WasteRoleFormViewModel SetListModel(WasteRoleFormViewModel model) { model.MainMenu = _mainMenu; model.CurrentMenu = PageInfo; model.UserList = GetUserIdList(); model.PlantList = GlobalFunctions.GetPlantAll(); //var listDetailsWaste = new List<WasteRoleFormDetails>(); //foreach (Enums.WasteGroup val in Enum.GetValues(typeof(Enums.WasteGroup))) //{ // var detailsWaste = new WasteRoleFormDetails(); // detailsWaste.IsChecked = false; // detailsWaste.WasteGroup = val; // detailsWaste.WasteGroupDescription = EnumHelper.GetDescription(val); // detailsWaste.WasteRoleId = 0; // foreach (var wasteRoleFormDetailse in model.Details) // { // if (wasteRoleFormDetailse.WasteGroup == detailsWaste.WasteGroup) // { // detailsWaste.IsChecked = true; // detailsWaste.WasteRoleId = wasteRoleFormDetailse.WasteRoleId; // break; // } // } // listDetailsWaste.Add(detailsWaste); //} //model.Details = listDetailsWaste; //return model; return(SetDetailGroupRole(model)); }
public ActionResult Edit(string id, MasterMobileModel MstrMobileDet) { try { var client = new MongoClient(constr); var db = client.GetDatabase(databaseName); var collection = db.GetCollection <MasterMobileModel>("tMasterMobile"); var filter = Builders <MasterMobileModel> .Filter.Eq("id", id); MstrMobileDet.uptAt = GlobalFunctions.GetIPAddress(); MstrMobileDet.uptBy = "User"; MstrMobileDet.uptOn = DateTime.Now; var set = Builders <MasterMobileModel> .Update .Set("id", MstrMobileDet.id) .Set("mstMblNo", MstrMobileDet.mstMblNo) .Set("mstMblCtrCd", MstrMobileDet.mstMblCtrCd) .Set("mstPosCode", MstrMobileDet.mstPosCode) .Set("otpMode", MstrMobileDet.otpMode) .Set("act", MstrMobileDet.act) .Set("otp", MstrMobileDet.otp) .Set("email", MstrMobileDet.email) .Set("expired", MstrMobileDet.expired) .Set("shnEndDate", MstrMobileDet.shnEndDate) .Set("uptOn", MstrMobileDet.uptOn) .Set("uptAt", MstrMobileDet.uptAt) .Set("uptBy", MstrMobileDet.uptBy); collection.FindOneAndUpdateAsync(filter, set); return(RedirectToAction("index")); } catch (Exception ex) { return(View()); } }
private void tsmiPreviewDetail_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStockReceiving", "Preview Detail")) { return; } foreach (DataRow _drStatus in loInventory.getInventoryStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "N") { MessageBoxUI _mbStatus = new MessageBoxUI("Only FINALIZED Inventory can be previewed!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } else if (_drStatus[2].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("You cannot preview a cancelled Inventory!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } else { previewInventoryDetail(dgvList.CurrentRow.Cells[0].Value.ToString()); } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmiPreviewDetail_Click"); em.ShowDialog(); return; } }
private UserPlantMapDetailViewModel InitEdit(string id) { var currenPlant = _userPlantMapBll.GetByUserId(id); var model = new UserPlantMapDetailViewModel { UserPlantMap = Mapper.Map <UserPlantMapDto>(currenPlant.FirstOrDefault()), Users = GlobalFunctions.GetUsers(), Nppbkcs = GlobalFunctions.GetNppbkcMultiSelectList(), CurrentMenu = PageInfo, MainMenu = _mainMenu, Plants = new List <PlantDto>() }; //process plant foreach (USER_PLANT_MAP t in currenPlant) { var toInsert = Mapper.Map <PlantDto>(t.T001W); toInsert.IS_IMPORT_ID = t.NPPBKC_ID != t.T001W.NPPBKC_ID; model.Plants.Add(toInsert); } model.SelectedNppbkc = model.Plants.GroupBy(x => (x.IS_IMPORT_ID ? x.NPPBKC_IMPORT_ID : x.NPPBKC_ID)).Select(x => x.Key).ToList(); return(model); }
private void btnSave_Click(object sender, EventArgs e) { try { loClientPersonalReference.Id = lId; loClientPersonalReference.ClientId = lClientId; loClientPersonalReference.Name = GlobalFunctions.replaceChar(txtName.Text); loClientPersonalReference.Relationship = cboRelationship.Text; loClientPersonalReference.CompleteAddress = GlobalFunctions.replaceChar(txtCompleteAddress.Text); loClientPersonalReference.SourceOfIncome = GlobalFunctions.replaceChar(txtSourceOfIncome.Text); loClientPersonalReference.CellphoneNo = GlobalFunctions.replaceChar(txtCellphoneNo.Text); loClientPersonalReference.Remarks = GlobalFunctions.replaceChar(txtRemarks.Text); loClientPersonalReference.UserId = GlobalVariables.UserId; string _Id = loClientPersonalReference.save(lOperation); if (_Id != "") { MessageBoxUI _mb = new MessageBoxUI("Personal Reference has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); lFromSave = true; this.Close(); } else { MessageBoxUI _mb = new MessageBoxUI("Failure to save the record!", GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnSave_Click"); em.ShowDialog(); return; } }
private void btnPreview_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmSalesReport", "Preview")) { return; } try { loStockCardRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loStockCardRpt.Database.Tables[1].SetDataSource(ldtReports); loStockCardRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loStockCardRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loStockCardRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loStockCardRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loStockCardRpt.SetParameterValue("Title", "Stock Card"); loStockCardRpt.SetParameterValue("SubTitle", "Stock Card"); loStockCardRpt.SetParameterValue("ItemDescription", dgvStockList.CurrentRow.Cells[1].Value.ToString()); loStockCardRpt.SetParameterValue("Unit", dgvStockList.CurrentRow.Cells[4].Value.ToString()); loStockCardRpt.SetParameterValue("QtyOnHand",string.Format("{0:n}", decimal.Parse(dgvStockList.CurrentRow.Cells[5].Value.ToString()))); loReportViewer.crystalReportViewer.ReportSource = loStockCardRpt; loReportViewer.ShowDialog(); } catch { } }
private void btnRefresh_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmStockCard", "Refresh")) { return; } try { ldtStock = loInventoryDetail.getStockInventoryList(cboLocation.SelectedValue.ToString(), ""); } catch { } GlobalFunctions.refreshGrid(ref dgvStockList, ldtStock); getDetails(); } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRefresh_Click"); em.ShowDialog(); return; } }
public async Task <bool> AddUser(TSUser tsUser, List <string> CallTrace) { try { CosmosDocUser newUser = new CosmosDocUser(tsUser) { Salt = GlobalFunctions.GetSalt() }; newUser.HashedPassword = GlobalFunctions.CmdHashPasswordBytes(tsUser.Password, newUser.Salt); await cosmosDBClientBase.AddItemAsync(newUser, LocalFunctions.AddThisCaller(CallTrace, MethodBase.GetCurrentMethod())); await CosmosAPI.cosmosDBClientCategory.AddDefaultCategory(tsUser.ID, LocalFunctions.AddThisCaller(CallTrace, MethodBase.GetCurrentMethod())); return(true); } catch (CosmosException ex) { await CosmosAPI.cosmosDBClientError.AddErrorLog(tsUser.ID, ex.Message, LocalFunctions.AddThisCaller(CallTrace, MethodBase.GetCurrentMethod())); return(false); } }
public void SetTexture(Texture texture = null) // Added default of null to enable SetTexture() to remove the current active image { if (texture != null) { if (activeImage == null) { CreateNewActiveImage(); } activeImage.texture = texture; activeImage.color = GlobalFunctions.SetAlpha(activeImage.color, 1f); // Removed depricated MovieTexture used in tutorial model. // See https://docs.unity3d.com/Manual/VideoPlayer-MigratingFromMovieTexture.html } else { if (activeImage != null) { allImages.Remove(activeImage); GameObject.DestroyImmediate(activeImage.gameObject); activeImage = null; } } }
void Randomize() { if (isNotRandom) // if the puzzle is not yet randomized { foreach (Transform t in PuzzlePieces) //foreach puzzle piece in the puzzle { if (t.name != "Puzzle") // if the puzzle piece is not the main puzzle { if (!t.GetComponentInChildren <PuzzlePieceScript>().isDoneRandomizing) // if the puzzlepiece is not yet randomize { int rand = rng.Next(0, PuzzlePieces.Length - 1); //select a random piece from the puzzle while (t == PuzzlePieces[rand] || PuzzlePieces[rand].name == "Puzzle") //while the slected random piece is already randomized, select another { rand = rng.Next(0, PuzzlePieces.Length - 1); } a = t.transform.position; //save the puzzle piece position to a goa = t.gameObject; //save the puzzle piece to goa b = PuzzlePieces[rand].position; // save the random piece position to b gob = PuzzlePieces[rand].transform.gameObject; //save the random puzzlepiece to gob t.position = b; //switch position of the current piece to random piece gob.transform.position = a; //swtich the random piece positon to current piece a = Vector3.zero; //reset position to x=0. y=0.z=0 b = Vector3.zero; //reset position to x=0. y=0.z=0 gob = null; //empty the gob goa = null; //empty the goa t.GetComponentInChildren <PuzzlePieceScript>().isDoneRandomizing = true; //set the status of current piece to already randomize PuzzlePieces[rand].GetComponentInChildren <PuzzlePieceScript>().isDoneRandomizing = true; //set the status of random piece to already randomize } } } isNotRandom = false; //when all piece is randomize, set the puzzle to randomized. GlobalFunctions.PlayAudio("koto4"); //play a sound gameStarted = true; } }
/// <summary> /// Install button /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Install_Click(object sender, RoutedEventArgs e) { UpdateManagerData data = gridMain.DataContext as UpdateManagerData; if (data != null) { if (data.IsInstalling) { MessageBox.Show("Visual Studio is currently already installing/uninstalling an API Level. Please wait until completion before proceeding.", "", MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); } else { if (!GlobalFunctions.isOnline()) { System.Windows.MessageBox.Show("You are currently experiencing internet connection issues and cannot access the Update Manager server. Please check your connection or try again later.", "Settings", MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK); } else { this.Simulators.IsEnabled = false; data.InstallAPI(((APITargetClass)((StackPanel)((Button)sender).Parent).DataContext).TargetVersion, false, false); } } } }
private static void AddTruckIntoWorld(IceCreamTruckManager ths, Lot lot) { IceCreamTruck car = GlobalFunctions.CreateObjectOutOfWorld("carTruckIceCream", ProductVersion.EP5, "Sims3.Gameplay.Objects.Vehicles.IceCreamTruck", null) as IceCreamTruck; if (car != null) { Vector3[] vectorArray; Quaternion[] quaternionArray; /* Lot lot = null; foreach (Lot lot2 in LotManager.AllLots) { if (!lot2.IsWorldLot) { lot = lot2; break; } } */ Matrix44 mat = new Matrix44(); car.StreetParkingBeingUsed = lot.StreetParking; car.StreetParkingBeingUsed.GetParkingSpotForCar(car, ref mat); if (World.FindPlaceOnRoadOffScreen(car.Proxy, mat.pos.V3, FindPlaceOnRoadOption.Road, 150f, out vectorArray, out quaternionArray)) { car.PlaceAt(vectorArray[0x0], mat.at.V3, null); car.BeginRoute(lot); car.AddMapTags(); ths.mIceCreamTrucks.Add(car); } else { car.Destroy(); } } }
private void btnPreview_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmReinventoryReport", "Preview")) { return; } try { loReinventoryRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loReinventoryRpt.Database.Tables[1].SetDataSource(ldtReports); loReinventoryRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loReinventoryRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loReinventoryRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loReinventoryRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loReinventoryRpt.SetParameterValue("Title", "Reinventory"); loReinventoryRpt.SetParameterValue("SubTitle", "Reinventory"); loReportViewer.crystalReportViewer.ReportSource = loReinventoryRpt; loReportViewer.ShowDialog(); } catch (Exception ex) { throw ex; } }
public IActionResult UpdateUserInfo([FromBody] userSettings currentUserSettings) { string userID = User.FindFirst(ClaimTypes.NameIdentifier)?.Value; DataAccess accessor = new DataAccess(); userSettings existingUserSettings = accessor.GetAll <userSettings>().FirstOrDefault(); if (existingUserSettings == null) { existingUserSettings = generateDefaultUserSettings(); accessor.Post(currentUserSettings); existingUserSettings = accessor.GetAll <userSettings>().FirstOrDefault(); existingUserSettings.firstName = currentUserSettings.firstName; existingUserSettings.lastName = currentUserSettings.lastName; existingUserSettings.theme = currentUserSettings.theme; } else { existingUserSettings.firstName = currentUserSettings.firstName; existingUserSettings.lastName = currentUserSettings.lastName; existingUserSettings.theme = currentUserSettings.theme; } currentUserSettings = GlobalFunctions.AddIdIfNeeded(existingUserSettings, existingUserSettings.idString); return(Json(accessor.Post(currentUserSettings))); }
public async Task <ActionResult> Post([FromBody] TSCategory TSCategory) { string userID = GlobalFunctions.CmdGetValueFromClaim(User.Claims, "UserID", 10); string userName = GlobalFunctions.CmdGetValueFromClaim(User.Claims, "UserName", 10); await TS.AddActivityLog(userID, "post Category", MethodBase.GetCurrentMethod()); GlobalFunctions.CmdDecryptEntityAsymm(TSCategory); string a = await TS.GetNewID(TSCategory.UserID, "LastCategoryID", false); TSCategory.CategoryID = int.Parse(a); bool b = await TS.AddCategory(TSCategory); if (b) { await GlobalFunctions.NotifyAdmin("New category " + userName + " " + TSCategory.Name); return(Ok("OK")); } else { return(Ok("Error:Can't add new Category!")); } }
private void Login(object sender, RoutedEventArgs e) { //HomeUserControl _homeUserControl = new HomeUserControl(); DatabaseConnection.SetConnection(); DatabaseConnection.querySystemDetail(); loginModel.login_username = usernameTextblock.Text; loginModel.Login_password = passwordTextblock.Password; loginMessage = LoginController.Login(loginModel); GlobalFunctions.ShowDebug(loginMessage.returnStatusModel.error_message); if (loginMessage.returnStatusModel.status == true) { //test solution store in GlobalVar but not recommend GlobalVariables._mainWindow.ListViewItemHome_Selected(sender, e); } else { passwordTextblock.Clear(); } }
private void btnUpdate_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Update")) { return; } for (int i = 0; i < lCountCol; i++) { lRecord[i] = dgvLists.CurrentRow.Cells[i].Value.ToString(); } if (lRecord.Length > 0) { if (lRecord[0].ToString() != "") { switch (lType.Name) { case "User": UserDetailUI loUserDetailUI = new UserDetailUI(lRecord); loUserDetailUI.ParentList = this; loUserDetailUI.ShowDialog(); break; } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnUpdate_Click"); em.ShowDialog(); return; } }
public PregnantViewModel(PregnantForm form, Baby baby) { Code = form.Code; ReferringMd = GlobalFunctions.GetMDFullName(form.ReferredByNavigation); RecordNumber = form.RecordNo; DateReferred = form.ReferredDate.ToString("dd/MM/yyyy"); ReferringMdContact = form.ReferredByNavigation.Contact; Facility = form.ReferringFacilityNavigation == null ? "" : form.ReferringFacilityNavigation.Name; FacilityContact = form.ReferringFacilityNavigation == null ? "" : form.ReferringFacilityNavigation.Contact; HealthWorker = form.HealthWorker; ReferredTo = form.ReferredToNavigation == null ? "" : form.ReferredToNavigation.Name; Department = form.Department == null ? "" : form.Department.Description; ReferredToAddress = GlobalFunctions.GetAddress(form.ReferredToNavigation); WomanName = GlobalFunctions.GetFullName(form.PatientWoman); WomanAge = GlobalFunctions.ComputeAge(form.PatientWoman.DateOfBirth); WomanAddress = GlobalFunctions.GetAddress(form.PatientWoman); WomanReason = form.WomanReason; WomanFindings = form.WomanMajorFindings; WomanBeforeTreatment = form.WomanBeforeTreatment; WomanBeforeGivenTime = GlobalFunctions.GetDate((DateTime)form.WomanBeforeGivenTime, "dd/MM/yyyy"); WomanDuringTransport = form.WomanDuringTransport; WomanDuringGivenTime = GlobalFunctions.GetDate((DateTime)form.WomanTransportGivenTime, "dd/MM/yyyy"); WomanInformationGiven = form.WomanInformationGiven; BabyName = form.PatientBaby == null? "" : GlobalFunctions.GetFullName(form.PatientBaby); BabyDob = form.PatientBaby == null ? "" : form.PatientBaby.DateOfBirth.ToString("dd/MM/yyyy"); BabyWeight = baby == null ? "" : baby.Weight == 0 ? "" : baby.Weight.ToString(); BabyGestationAge = baby == null? "" : baby.GestationalAge.ToString(); BabyReason = form.BabyReason; BabyFindings = form.BabyMajorFindings; BabyLastFeed = GlobalFunctions.GetDate((DateTime)form.BabyLastFeed, "dd/MM/yyyy"); BabyBeforeTreatment = form.BabyBeforeTreatment; BabyBeforeGivenTime = GlobalFunctions.GetDate((DateTime)form.BabyBeforeGivenTime, "dd/MM/yyyy"); BabyDuringTransport = form.BabyDuringTransport; BabyDuringGivenTime = GlobalFunctions.GetDate((DateTime)form.BabyTransportGivenTime, "dd/MM/yyyy"); BabyInformationGiven = form.BabyInformationGiven; }
private void tsmiPreviewDetails_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmSalesOrder", "Preview Details")) { return; } foreach (DataRow _drStatus in loSalesOrder.getSalesOrderStatus(dgvList.CurrentRow.Cells[0].Value.ToString()).Rows) { if (_drStatus[0].ToString() == "N") { MessageBoxUI _mbStatus = new MessageBoxUI("Only APPROVED Sales Order can be previewed!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } else if (_drStatus[2].ToString() == "Y") { MessageBoxUI _mbStatus = new MessageBoxUI("You cannot preview a cancelled Sales Order!", GlobalVariables.Icons.Warning, GlobalVariables.Buttons.OK); _mbStatus.ShowDialog(); return; } else { previewSalesOrderDetail(dgvList.CurrentRow.Cells[0].Value.ToString()); } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "tsmiPreviewBilling_Click"); em.ShowDialog(); return; } }
private void btnRemove_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmUserGroups", "Remove")) { return; } if (lUserGroupId != null) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { MySqlTransaction Trans = GlobalVariables.Connection.BeginTransaction(); try { if (loUserGroup.removeUserGroup(lUserGroupId, ref Trans)) { Trans.Commit(); MessageBoxUI _mb1 = new MessageBoxUI("Usergroup has been successfully removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); refresh("ViewAll", ""); loadAllMenuItems(); } } catch (Exception ex) { Trans.Rollback(); MessageBoxUI mb = new MessageBoxUI(ex, GlobalVariables.Icons.Error, GlobalVariables.Buttons.OK); mb.ShowDialog(); return; } } } }
private void btnRefresh_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsmJournalEntry", "Refresh")) { return; } DataTable _dt = loJournalEntry.getJournalEntryReport(dtpFinancialYear.Value.Year); if (_dt.Rows.Count > 0) { loJournalEntryRpt.SetDataSource(GlobalVariables.DTCompanyLogo); loJournalEntryRpt.Database.Tables[1].SetDataSource(loJournalEntry.getJournalEntryReport(dtpFinancialYear.Value.Year)); loJournalEntryRpt.SetParameterValue("CompanyName", GlobalVariables.CompanyName); loJournalEntryRpt.SetParameterValue("CompanyAddress", GlobalVariables.CompanyAddress); loJournalEntryRpt.SetParameterValue("CompanyContactNumber", GlobalVariables.ContactNumber); loJournalEntryRpt.SetParameterValue("Username", GlobalVariables.Userfullname); loJournalEntryRpt.SetParameterValue("Title", "Journal Entry"); loJournalEntryRpt.SetParameterValue("SubTitle", "Journal Entry"); loJournalEntryRpt.SetParameterValue("FinancialYear", dtpFinancialYear.Value.Year.ToString()); crystalReportViewer.ReportSource = loJournalEntryRpt; } else { MessageBoxUI _mb = new MessageBoxUI("No records found!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRefresh_Click"); em.ShowDialog(); return; } }
private void btnSaveMenu_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmUserGroups", "Save Menu")) { return; } try { if (loUserGroup.updateUserGroupMenuItem(dgvUserGroups.CurrentRow.Cells[0].Value.ToString(), GlobalFunctions.convertDataGridToDataTable(dgvMenuItems))) { MessageBoxUI _mb = new MessageBoxUI("User Rights has been saved successfully!", GlobalVariables.Icons.Save, GlobalVariables.Buttons.OK); _mb.showDialog(); } } catch (Exception ex) { if (ex.Message.Contains("Duplicate")) { MessageBoxUI _mb = new MessageBoxUI(ex.Message, GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb.showDialog(); return; } } }
void OffensiveBehaviour() { if (offensiveTimeCount >= offensiveTime) { currState = BehaviourStates.idling; idlingTimeCount = 0; } else { offensiveTimeCount += Time.deltaTime; if (target) { desiredShipSpeed = Mathf.Clamp01((GlobalFunctions.DistanceOnHorizontalPlane(transform.position, target.position) - attackingDistance) * distanceSpeedMultiplier); Vector3 localTarget = transform.InverseTransformPoint(target.position); float targetAngle = Mathf.Atan2(localTarget.x, localTarget.z) * Mathf.Rad2Deg; desiredTurnSpeed = Mathf.Clamp(targetAngle, -1, 1); } else { SelectTarget(); } } }
/// <summary> /// Parse number of bit mask into user information /// </summary> /// <param name="bitMask">bit mask number</param> /// <returns></returns> private void ParseBitMaskToObject(long bitMask, ref BitMaskOfUser bitMaskItem) { //variables string binaryString = GlobalFunctions.ParseNumberToBinary(bitMask); try { bitMaskItem.View.Add(binaryString[0] == '0' ? false : true); bitMaskItem.Add.Add(binaryString[1] == '0' ? false : true); bitMaskItem.Edit.Add(binaryString[2] == '0' ? false : true); bitMaskItem.Delete.Add(binaryString[3] == '0' ? false : true); //initialize value of bitmask for (int i = 4; i < binaryString.Length; i++) { if (binaryString[i] == '1') { bitMaskItem.NumberOfBitMask.Add(Convert.ToInt32(Math.Pow(2, i))); } } } catch { } }
public override void AddInteractions(InteractionObjectPair iop, Sim actor, IGameObject target, List <InteractionObjectPair> results) { CraftersConsignment targetObject = null; if (this.mParentRug != ObjectGuid.InvalidObjectGuid) { targetObject = GlobalFunctions.ConvertGuidToObject <CraftersConsignment>(this.mParentRug); } for (IGameObject obj2 = target.Parent; (targetObject == null) && (obj2 != null); obj2 = obj2.Parent) { targetObject = obj2 as CraftersConsignment; } if ((targetObject != null) && DisplayHelper.TestIfObjectCanBeBoughtByActor(target, actor)) //DisplayHelper.GetObjectsICanBuyInDisplay(actor, targetObject).Contains(target.ObjectId)) { ServingContainerGroup groupServing = target as ServingContainerGroup; if (groupServing != null) { results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(groupServing, true), targetObject)); results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(groupServing, false), targetObject)); return; } results.Add(new InteractionObjectPair(new PurchaseItemEx.Definition(target.ObjectId, false), targetObject)); } }
private void btnRefresh_Click(object sender, EventArgs e) { if (!GlobalFunctions.checkRights("tsmReorderLevelReport", "Refresh")) { return; } try { dgvReport.Rows.Clear(); } catch { dgvReport.DataSource = null; } try { ldtReports = loStock.getStockReinventory(); GlobalFunctions.refreshGrid(ref dgvReport, ldtReports); } catch { } }
private void btnRemove_Click(object sender, EventArgs e) { try { if (!GlobalFunctions.checkRights("tsm" + lType.Name, "Remove")) { return; } if (lRecord.Length > 0) { if (lRecord[0].ToString() != null) { DialogResult _dr = new DialogResult(); MessageBoxUI _mb = new MessageBoxUI("Are sure you want to continue removing this record?", GlobalVariables.Icons.QuestionMark, GlobalVariables.Buttons.YesNo); _mb.ShowDialog(); _dr = _mb.Operation; if (_dr == DialogResult.Yes) { object[] param = { lRecord[0].ToString() }; if ((bool)lObject.GetType().GetMethod("remove").Invoke(lObject, param)) { MessageBoxUI _mb1 = new MessageBoxUI(lType.Name + " has been successfully removed!", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); _mb1.ShowDialog(); refresh("ViewAll", "", "", true); } } } } } catch (Exception ex) { ErrorMessageUI em = new ErrorMessageUI(ex.Message, this.Name, "btnRemove_Click"); em.ShowDialog(); return; } }
private void btnFind_Click(object sender, EventArgs e) { OpenFileDialog openFD = new OpenFileDialog(); openFD.InitialDirectory = ".../Main/ScreenSaverImages/"; openFD.Title = "Insert an Image"; openFD.Filter = "JPEG Images|*.jpg|GIF Images|*.gif|PNG Images|*.png"; if (openFD.ShowDialog() == DialogResult.Cancel) { MessageBoxUI mb = new MessageBoxUI("Operation Cancelled", GlobalVariables.Icons.Information, GlobalVariables.Buttons.OK); mb.ShowDialog(); } else { lChosenFile = openFD.FileName; string _FileName = openFD.SafeFileName; byte[] m_Bitmap = null; FileStream fs = new FileStream(lChosenFile, FileMode.Open); BinaryReader br = new BinaryReader(fs); int length = (int)br.BaseStream.Length; m_Bitmap = new byte[length]; m_Bitmap = br.ReadBytes(length); br.Close(); fs.Close(); lScreenSaverImage = GlobalFunctions.ToHex(m_Bitmap); pctCurrentPicture.BackgroundImage = GlobalFunctions.ConvertByteArrayToImage(m_Bitmap); pctCurrentPicture.BackgroundImageLayout = ImageLayout.Stretch; byte[] hextobyte = GlobalFunctions.HexToBytes(GlobalVariables.ScreenSaverImage); pctPreviousPicture.BackgroundImage = GlobalFunctions.ConvertByteArrayToImage(hextobyte); pctPreviousPicture.BackgroundImageLayout = ImageLayout.Stretch; } }