protected void btnSave_Click(object sender, EventArgs e) { try { string Action = Globals.GetStringFromQueryString("Action"); OtherFunctions obj = new OtherFunctions(); HttpPostedFile hpf = FileUploadVideo.PostedFile; if (FileUploadVideo.HasFile) { FileVideoSource = hpf.FileName; } if (FileImageName != "" & FileVideoSource != "") { FileExt = FileVideoSource.Substring(FileVideoSource.Length - 3); hpf.SaveAs(Globals.GetPhysicalUploadsUrl() + FileVideoSource); if (FileExt.ToLower() == "wmv" || FileExt.ToLower() == "flv") { int ProductID = 0; string VideoName = txtVideoName.Text.Trim(); int kq = -1; if (Action == "Edit") { int VideoID = Globals.GetIntFromQueryString("VideoID"); kq = obj.UpdateVideoClip(VideoID, Globals.AgentCatID, ddlLanguage.SelectedValue, ProductID, FileImageName, FileVideoSource, VideoName, FileExt); ShowMessage(kq, "cập nhật"); } else { kq = obj.InsertVideoClip(Globals.AgentCatID, ddlLanguage.SelectedValue, ProductID, FileImageName, FileVideoSource, VideoName, FileExt); ShowMessage(kq, "thêm"); } ddlLanguage2.SelectedValue = ddlLanguage.SelectedValue; Response.Redirect("VideoClip.aspx"); } else { MessageBox.Show("Vui lòng chỉ chọn file .flv hoặc .wmv để upload!"); } } else if (FileImageName == "") { MessageBox.Show("Vui lòng chọn file hình ảnh đại diện!"); } else if (FileVideoSource == "") { MessageBox.Show("Vui lòng chọn file Video Clip!"); } } catch (System.IO.IOException) { MessageBox.Show("Đã tồn tại file có tên này rồi! Vui lòng đổi tên hoặc chọn file khác!"); } }
private void DateTimeLabel_Click(object sender, EventArgs e) { if (ApplicationDeployment.IsNetworkDeployed) { OtherFunctions.Message(ApplicationDeployment.CurrentDeployment.CurrentVersion.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information, "Version", this); } else { OtherFunctions.Message("Debug", MessageBoxButtons.OK, MessageBoxIcon.Information, "Version", this); } }
private void LoadGridViewItem() { try { OtherFunctions obj = new OtherFunctions(); DataSet ds = obj.GetAllDistrict("District", Globals.AgentCatID, CountryID); GridViewHelper gvHelper = new GridViewHelper(); gvHelper.FillData(gridViewItem, ds); } catch { } }
private void AssetInputFormToolItem_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(currentViewDevice.PO)) { new PdfFormFilling(this, currentViewDevice, PdfFormFilling.PdfFormType.InputForm); } else { OtherFunctions.Message("Please add a valid PO number to this device.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Missing Info", this); } }
private void LoadGridViewService(string Lang) { try { OtherFunctions objFunc = new OtherFunctions(); DataSet ds = objFunc.GetAllService("Service", Globals.AgentCatID, Lang); GridViewHelper gvHelper = new GridViewHelper(); gvHelper.FillData(gridViewService, ds); } catch { } }
public static string GetLang() { string Lang = GetStringFromQueryString("Lang"); OtherFunctions obj = new OtherFunctions(); if (obj.IsHaveLanguage(Lang, AgentCatID) == false) { Lang = DefaultLang; } return(Lang); }
private void LoadGridViewPartner() { try { OtherFunctions objFunc = new OtherFunctions(); DataSet ds = objFunc.GetAllPartner("Partner", Globals.AgentCatID); GridViewHelper gvHelper = new GridViewHelper(); gvHelper.FillData(gridViewPartner, ds); } catch { } }
private void LoadGridViewFileDownload() { try { OtherFunctions obj = new OtherFunctions(); DataSet ds = obj.GetAllFileDownload("FileDownload", Globals.AgentCatID); GridViewHelper gvHelper = new GridViewHelper(); gvHelper.FillData(gridViewFileDownload, ds); } catch { } }
private void LoadSupportOnlineList() { //try { OtherFunctions obj = new OtherFunctions(); DataSet ds = obj.GetAllSupportOnline("SupportOnline", Globals.AgentCatID); GridViewHelper gvHelper = new GridViewHelper(); gvHelper.FillData(gridViewSupportOnline, ds); } //catch { } }
private void CriticalStop(object sender, EventArgs e) { StopQueue(); OtherFunctions.Message("The queue was stopped because of an access error. Please re-enter your credentials.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Queue Stopped", this); SecurityTools.ClearAdminCreds(); if (SecurityTools.VerifyAdminCreds()) { StartQueue(); } }
private void CheckIn() { using (var trans = DBFactory.GetDatabase().StartTransaction()) using (var conn = trans.Connection) { try { if (!GetCheckData()) { return; } Waiting(); int rows = 0; rows += DBFactory.GetDatabase().UpdateValue(DevicesCols.TableName, DevicesCols.CheckedOut, 0, DevicesCols.DeviceGuid, currentTrackingDevice.Guid, trans); ParamCollection checkParams = new ParamCollection(); checkParams.Add(TrackablesCols.CheckType, CheckType.Checkin); checkParams.Add(TrackablesCols.CheckoutTime, checkData.CheckoutTime); checkParams.Add(TrackablesCols.DueBackDate, checkData.DueBackTime); checkParams.Add(TrackablesCols.CheckinTime, checkData.CheckinTime); checkParams.Add(TrackablesCols.CheckoutUser, checkData.CheckoutUser); checkParams.Add(TrackablesCols.CheckinUser, checkData.CheckinUser); checkParams.Add(TrackablesCols.UseLocation, checkData.UseLocation); checkParams.Add(TrackablesCols.Notes, checkData.CheckinNotes); checkParams.Add(TrackablesCols.DeviceGuid, checkData.Guid); rows += DBFactory.GetDatabase().InsertFromParameters(TrackablesCols.TableName, checkParams.Parameters, trans); if (rows == 2) { trans.Commit(); OtherFunctions.Message("Device Checked In!", MessageBoxButtons.OK, MessageBoxIcon.Information, "Success", this); } else { trans.Rollback(); OtherFunctions.Message("Unsuccessful! The number of affected rows was not what was expected.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Unexpected Result", this); } ParentForm.RefreshData(); } catch (Exception ex) { trans.Rollback(); ErrorHandling.ErrHandle(ex, System.Reflection.MethodBase.GetCurrentMethod()); } finally { this.Dispose(); } } }
public ImageHandler(string pathToImage, bool itsFullPath, CMSDatabase db, IHostingEnvironment env) { this.db = db; this.env = env; if (pathToImage[pathToImage.Length - 1].Equals('/')) { return; } pathToImageFolder = pathToImage.Substring(0, pathToImage.LastIndexOf('/') + 1); sourceImageName = pathToImage.Substring(pathToImageFolder.Length); if (!sourceImageName.Contains(".")) { return; } sourceImageName = sourceImageName.Substring(0, sourceImageName.LastIndexOf('.')); sourceImageExtension = pathToImage.Substring(pathToImageFolder.Length + sourceImageName.Length); if ((!sourceImageExtension.Equals(".jpg", StringComparison.OrdinalIgnoreCase) && !sourceImageExtension.Equals(".jpeg", StringComparison.OrdinalIgnoreCase) && !sourceImageExtension.Equals(".png", StringComparison.OrdinalIgnoreCase))) { return; } if (!itsFullPath) { if (pathToImageFolder[0].Equals('/')) { pathToImageFolder = pathToImageFolder.Substring(1); } pathToImageFolder = env.GetStorageFolderFullPath() + pathToImageFolder; } sourceImageFullName = sourceImageName + sourceImageExtension; sourceImageFullPath = pathToImageFolder + sourceImageFullName; isExisted = File.Exists(sourceImageFullPath); sourceImageShortPath = sourceImageFullPath.Substring(env.GetStorageFolderFullPath().Length).Insert(0, "/"); // Если изображения не существует, то удаляем зависимые изображения, если таковые имеются и информацию из БД if (!isExisted) { // Удаляем информацию об изображении из БД Image image = db.Images.FirstOrDefault(img => img.ShortPathHash == OtherFunctions.GetHashFromString(sourceImageShortPath) && img.ShortPath.Equals(sourceImageShortPath, StringComparison.Ordinal)); if (image != null) { db.Images.Remove(image); db.SaveChanges(); } ImagesManagementFunctions.DeleteDependentImages(pathToImageFolder, sourceImageFullName); } else { GetSourceImageInfo(); } }
private void StartTransaction() { SecurityTools.CheckForAccess(SecurityGroups.CanStartTransaction); if (OtherFunctions.Message("This will allow unchecked changes to the database. Incorrect inputs WILL BREAK THINGS! \r\n" + Environment.NewLine + "Changes must be 'applied' and 'committed' before they will be permanently stored in the database.", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, "WARNING", this) == DialogResult.OK) { currentTransaction = DBFactory.GetDatabase().StartTransaction(); RefreshData(); GridEditMode(true); DoneWaiting(); } }
private void ShowIP() { if (pingVis.CurrentResult != null && pingVis.CurrentResult.Address != null) { string address = pingVis.CurrentResult.Address.ToString(); var blah = OtherFunctions.Message(address + " - " + NetworkInfo.LocationOfIP(address) + "\r\n" + "\r\n" + "Press 'Yes' to copy to clipboard.", MessageBoxButtons.YesNo, MessageBoxIcon.Information, "IP Address", hostForm); if (blah == DialogResult.Yes) { Clipboard.SetText(address); } } }
private static bool HasResults(DataTable results, Form parentForm) { if (results != null && results.Rows.Count > 0) { return(true); } else { OtherFunctions.Message("No results found.", MessageBoxButtons.OK, MessageBoxIcon.Information, "No results", parentForm); return(false); } }
protected void gridViewSupportOnline_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = gridViewSupportOnline.Rows[e.RowIndex]; Int32 NickID = Convert.ToInt32(((Label)row.Cells[0].FindControl("lblNickID")).Text); OtherFunctions obj = new OtherFunctions(); obj.DeleteSupportOnline(NickID); LoadSupportOnlineList(); } catch { } }
public ActionResult Edit(CourseLevelAddFullViewModel model) { if ((model.AddCourseLevelViewModel.Description != null && OtherFunctions.IsHasJS(model.AddCourseLevelViewModel.Description)) || !ModelState.IsValid || (model.AddCourseLevelViewModel.AutomaticTestId == 0 && model.AddCourseLevelViewModel.ManualTestId == 0)) { var teacher = this.userService.GetTeacherByAppUserId(this.User.Identity.GetUserId()); var autoTest = this.automaticTestService.GetForTeacher(teacher.Id).ToList().ConvertAll(x => new ShowAutomaticTestBaseViewModel { Id = x.Id, Title = x.Title }); var manTest = this.manualTestService.GetForTeacher(teacher.Id).ToList().ConvertAll(x => new ManualTestShowBaseViewModel { Id = x.Id, Title = x.Title }); model.AutomaticTests = autoTest; model.ManualTests = manTest; } if (model.AddCourseLevelViewModel.Description != null && OtherFunctions.IsHasJS(model.AddCourseLevelViewModel.Description)) { ModelState.AddModelError("", Common.FieldDescriptionDanger); return(View(model)); } if (!ModelState.IsValid || (model.AddCourseLevelViewModel.AutomaticTestId == 0 && model.AddCourseLevelViewModel.ManualTestId == 0)) { ModelState.AddModelError("", Common.NoChooseTest); return(View(model)); } var addModel = new CourseLevel { CourseId = model.AddCourseLevelViewModel.CourseId, Name = model.AddCourseLevelViewModel.Name, Id = model.AddCourseLevelViewModel.Id, Description = model.AddCourseLevelViewModel.Description }; if (model.AddCourseLevelViewModel.AutomaticTestId != 0) { addModel.AutomaticTestId = model.AddCourseLevelViewModel.AutomaticTestId; } else if (model.AddCourseLevelViewModel.ManualTestId != 0) { addModel.ManualTestId = model.AddCourseLevelViewModel.ManualTestId; } this.courseLevelService.Update(addModel); return(Redirect("/CourseLevel/Details/" + model.AddCourseLevelViewModel.Id)); }
protected void btnDelete_Click(object sender, EventArgs e) { try { Int32 PartnerID = Globals.GetIntFromQueryString("PartnerID"); OtherFunctions obj = new OtherFunctions(); String imageFileName = obj.GetPartnerLogoByPartnerID(PartnerID); Globals.DeleteFile(imageFileName); obj.DeletePartner(PartnerID); LoadGridViewPartner(); } catch { } }
protected void btnDelete_Click(object sender, EventArgs e) { try { Int32 NickID = Globals.GetIntFromQueryString("NickID"); OtherFunctions obj = new OtherFunctions(); int kq = -1; kq = obj.DeleteSupportOnline(NickID); ShowMessage(kq, "xóa"); LoadSupportOnlineList(); } catch { } }
private bool FlattenPrompt() { var blah = OtherFunctions.Message("Select 'Yes' to save the PDF as an editable form. Select 'No' to save the PDF as a flattened, ready to print document.", MessageBoxButtons.YesNo, MessageBoxIcon.Question, "PDF Type"); if (blah == DialogResult.Yes) { return(false); } else { return(true); } }
protected void btnSearch_Click(object sender, EventArgs e) { try { string strSearch = txtSearch.Text.Trim(); string Lang = ddlLanguage.SelectedValue; OtherFunctions obj = new OtherFunctions(); DataSet ds = obj.SearchServiceByText("Service", strSearch, Lang, Globals.AgentCatID); GridViewHelper gvHelper = new GridViewHelper(); gvHelper.FillData(gridViewService, ds); } catch { } }
protected void btnDelete_Click(object sender, EventArgs e) { try { Int32 DistrictID = Globals.GetIntFromQueryString("DistrictID"); OtherFunctions obj = new OtherFunctions(); obj.DeleteDistrict(DistrictID); LoadGridViewItem(); } catch { } }
protected void btnDelete_Click(object sender, EventArgs e) { try { Int32 ServiceID = Globals.GetIntFromQueryString("ServiceID"); OtherFunctions obj = new OtherFunctions(); String imageFileName = obj.GetServiceImageUrlByServiceID(ServiceID); Globals.DeleteFile(imageFileName); obj.DeleteService(ServiceID); Response.Redirect("ServiceList.aspx"); } catch { } }
protected void gridViewService_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = gridViewService.Rows[e.RowIndex]; Int32 ServiceID = Convert.ToInt32(((Label)row.Cells[0].FindControl("lblServiceID")).Text); OtherFunctions obj = new OtherFunctions(); String imageFileName = obj.GetServiceImageUrlByServiceID(ServiceID); Globals.DeleteFile(imageFileName, "ImageFiles/Services"); obj.DeleteService(ServiceID); LoadGridViewService(ddlLanguage.SelectedValue); } catch { } }
protected void gridViewItem_RowDeleting(object sender, GridViewDeleteEventArgs e) { try { GridViewRow row = gridViewItem.Rows[e.RowIndex]; Int32 DistrictID = Convert.ToInt32(((Label)row.Cells[0].FindControl("lblDistrictID")).Text); OtherFunctions obj = new OtherFunctions(); obj.DeleteDistrict(DistrictID); LoadGridViewItem(); } catch { } }
private void LoadPhotoList() { try { OtherFunctions obj = new OtherFunctions(); DataSet ds = obj.GetImageListSlideIndex("ImageSlideIndex", Globals.AgentCatID); DataListHelper dlHelper = new DataListHelper(); if (ds.Tables.Count > 0) { dlHelper.FillData(DataListImage, ds); } } catch { } }
private void NewPackButton_Click(object sender, EventArgs e) { if (working) { return; } var prompt = OtherFunctions.Message("Are you sure? This will replace the packfile on the server with a new one created from the local GK Directory.", MessageBoxButtons.OKCancel, MessageBoxIcon.Exclamation, "Warning", this); if (prompt == DialogResult.OK) { NewPackFile(); } }
public async Task <bool> InvokePowerShellCommand(Command pScommand) { var scriptResult = await Task.Run(() => { return(InvokeRemotePSCommand(SecurityTools.AdminCreds, pScommand)); }); if (!string.IsNullOrEmpty(scriptResult)) { OtherFunctions.Message(scriptResult, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Error Running Script"); return(false); } else { return(true); } }
public async Task <bool> ExecutePowerShellScript(byte[] scriptByte) { var scriptResult = await Task.Run(() => { return(ExecuteRemotePSScript(scriptByte, SecurityTools.AdminCreds)); }); if (!string.IsNullOrEmpty(scriptResult)) { OtherFunctions.Message(scriptResult, MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Error Running Script"); return(false); } else { return(true); } }
public override bool OkToClose() { if (currentTransaction != null) { OtherFunctions.Message("There is currently an active transaction. Please commit or rollback before closing.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "Cannot Close"); return(false); } if (!OtherFunctions.OKToEnd()) { return(false); } return(true); }