public static UserDto GetLoginUser(this HttpRequestMessage request) { var ticket = request.GetHeader(LsConstant.LOTTERY_SERVICE_TICKET); if (string.IsNullOrEmpty(ticket)) { throw new LSException("请先登录系统."); } JObject playLoad = null; try { playLoad = AppUtils.GetPayloadFromToken(ticket, Utils.GetConfigValuesByKey(LsConstant.JwtSecret)); } catch (Exception ex) { throw new LSException("票据无效,请通过合法的途径请求API"); } // :todo 判断用户是否登录超时,如果登录超时,则直接登出 // :todo 重构, 缓存,需要从缓存中获取用户,不是直接从数据库中获取用户信息 var appAccountService = ServiceLocator.Current.GetInstance <AccountAppService>(); var user = appAccountService.GetUserByTokenId(playLoad[LsConstant.TokenId].ToString()); if (user == null) { if (appAccountService.IsOnline(playLoad[LsConstant.AccountName].ToString())) { throw new LSException("票据无效,请通过合法途径访问API"); } // :todo 登出操作 throw new LSException("用户已登出"); } return(Mapper.Map(user, new UserDto())); }
protected void btnGenerate_Click(object sender, EventArgs e) { PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); DateTime dtAsOfDate = new DateTime(); if (!DateTime.TryParse(AsOfDate.Value, out dtAsOfDate)) { if (string.IsNullOrEmpty(AsOfDate.Value)) { dtAsOfDate = AppUtils.ServerDateTime().Date; } else { return; } } ArrayList values = WebUtils.SelectedRepeaterItemToBaseObjectList(EEmpPersonalInfo.db, Repeater, "ItemSelect"); if (values.Count <= 0) { errors.addError(HROne.Translation.PageErrorMessage.ERROR_NO_EMPLOYEE_SELECTED); } if (errors.isEmpty()) { HROne.Reports.Payroll.LongServicePaymentSeverancePaymentProcess rpt = new HROne.Reports.Payroll.LongServicePaymentSeverancePaymentProcess(dbConn, values, dtAsOfDate); string reportFileName = WebUtils.GetLocalizedReportFile(Server.MapPath("~/Report_Payroll_LongServicePaymentSeverancePayment_List.rpt")); WebUtils.ReportExport(dbConn, user, errors, lblReportHeader.Text, Response, rpt, reportFileName, ((Button)sender).CommandArgument, "LongServicePaymentSeverancePayment", true); } //Session["AsOfDate"] = AsOfDate.Text; //Session["Report_EmployeeList"] = values; //HROne.Common.WebUtility.RedirectURLwithEncryptedQueryString(Response, Session, "Report_LeaveSummary_View.aspx"); }
public override async void Initialize(INavigationParameters parameters) { loggerService.StartMethod(); var startDate = userDataService.GetStartDate(); StartDate = startDate.ToLocalTime().ToString("D"); var daysOfUse = userDataService.GetDaysOfUse(); PastDate = daysOfUse.ToString(); // Check Version AppUtils.CheckVersion(loggerService); try { await exposureNotificationService.StartExposureNotification(); await exposureNotificationService.FetchExposureKeyAsync(); var statusMessage = await exposureNotificationService.UpdateStatusMessageAsync(); loggerService.Info($"Exposure notification status: {statusMessage}"); base.Initialize(parameters); loggerService.EndMethod(); } catch (Exception ex) { Debug.WriteLine(ex.ToString()); loggerService.Exception("Failed to exposure notification status.", ex); loggerService.EndMethod(); } }
protected void Add_Click(object sender, EventArgs e) { Repeater.EditItemIndex = -1; EQualification c = new EQualification(); Hashtable values = new Hashtable(); binding.toValues(values); PageErrors errors = PageErrors.getErrors(db, Page.Master); errors.clear(); db.validate(errors, values); if (!errors.isEmpty()) { return; } db.parse(values, c); if (!AppUtils.checkDuplicate(dbConn, db, c, errors, "QualificationCode")) { return; } WebUtils.StartFunction(Session, FUNCTION_CODE); db.insert(dbConn, c); WebUtils.EndFunction(dbConn); QualificationCode.Text = string.Empty; QualificationDesc.Text = string.Empty; view = loadData(info, db, Repeater); }
public ActionResult InsertDistributionReasonFromPopUp(DistributionReason DistributionReason_Client) { DistributionReason distributionReason_Check = db.DistributionReason.Where(s => s.DistributionReasonName == DistributionReason_Client.DistributionReasonName.Trim()).FirstOrDefault(); if (distributionReason_Check != null) { // TempData["AlreadyInsert"] = "DistributionReason Already Added. Choose different DistributionReason. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } DistributionReason distributionReason_Return = new DistributionReason(); try { DistributionReason_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); DistributionReason_Client.CreatedDate = AppUtils.GetDateTimeNow(); distributionReason_Return = db.DistributionReason.Add(DistributionReason_Client); db.SaveChanges(); if (distributionReason_Return.DistributionReasonID > 0) { // TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, DistributionReason = distributionReason_Return }, JsonRequestBehavior.AllowGet)); } else { // TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertAssetTypeFromPopUp(AssetType AssetType_Client) { AssetType band_Check = db.AssetType.Where(s => s.AssetTypeName == AssetType_Client.AssetTypeName.Trim()).FirstOrDefault(); if (band_Check != null) { // TempData["AlreadyInsert"] = "AssetType Already Added. Choose different AssetType. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } AssetType AssetType_Return = new AssetType(); try { AssetType_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); AssetType_Client.CreatedDate = AppUtils.GetDateTimeNow(); AssetType_Return = db.AssetType.Add(AssetType_Client); db.SaveChanges(); if (AssetType_Return.AssetTypeID > 0) { // TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, AssetType = AssetType_Return }, JsonRequestBehavior.AllowGet)); } else { // TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertIPPool(IPPool IPPool_Client) { IPPool IPPool_Check = db.IPPool.Where(s => s.PoolName == IPPool_Client.PoolName.Trim()).FirstOrDefault(); if (IPPool_Check != null) { TempData["AlreadyInsert"] = "IPPool Already Added. Choose different IPPool. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } IPPool IPPool_Return = new IPPool(); try { IPPool_Client.CreatedBy = int.Parse(Session["LoggedUserID"].ToString());//AppUtils.LoginUserID; IPPool_Client.CreatedDate = AppUtils.GetDateTimeNow(); IPPool_Return = db.IPPool.Add(IPPool_Client); db.SaveChanges(); if (IPPool_Return.IPPoolID > 0) { TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, IPPool = IPPool_Return }, JsonRequestBehavior.AllowGet)); } else { TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
protected void btnExport_Click(object sender, EventArgs e) { DataTable tmpDataTable = new DataTable(TABLE_NAME); tmpDataTable.Columns.Add("Scheme Code", typeof(string)); tmpDataTable.Columns.Add("Capacity", typeof(string)); tmpDataTable.Columns.Add("First Point", typeof(Decimal)); tmpDataTable.Columns.Add("Mid Point", typeof(Decimal)); tmpDataTable.Columns.Add("Last Point", typeof(Decimal)); DBFilter filter = sbinding.createFilter(); filter.add("LastPoint", false); ArrayList list = EPayScale.db.select(dbConn, filter); foreach (EPayScale c in list) { DataRow row = tmpDataTable.NewRow(); //row["ID"] = c.PayScaleID; row["Scheme Code"] = c.SchemeCode; row["Capacity"] = c.Capacity; row["First Point"] = c.FirstPoint; row["Mid Point"] = c.MidPoint; row["Last Point"] = c.LastPoint; tmpDataTable.Rows.Add(row); } string exportFileName = System.IO.Path.GetTempFileName(); System.IO.File.Delete(exportFileName); exportFileName += ".xls"; HROne.Export.ExcelExport excelExport = new HROne.Export.ExcelExport(exportFileName); excelExport.Update(tmpDataTable); WebUtils.TransmitFile(Response, exportFileName, "PayScale_" + AppUtils.ServerDateTime().ToString("yyyyMMddHHmmss") + ".xls", true); return; }
/// <summary> /// 初始化事件 /// </summary> protected override void InitEvents() { // 返回 imgbtnBack.Click += (sender, e) => { CurrActivity.Finish(); OverridePendingTransition(Resource.Animation.left_in, Resource.Animation.right_out); }; // 选择负责校区 rlAreas.Click += (sender, e) => { Intent intent = new Intent(CurrActivity, typeof(AreaSelectMultiActivity)); if (currShopManager != null) { intent.PutExtra("areaCodes", AreaCodes); } StartActivityForResult(intent, 1); CurrActivity.OverridePendingTransition(Resource.Animation.right_in, Resource.Animation.left_out); }; //保存并继续添加 btnAdd.Click += (sender, e) => { DoSave(true); }; //完成 tvSave.Click += (sender, e) => { DoSave(false); }; //删除 btnDelete.Click += (sender, e) => { var callbackFunc = new AppUtils.ShowDialogClick(CallbackFun); AppUtils.ShowDialog(CurrActivity, "提示", "您确认要删除此信息吗?", 2, callbackFunc); }; }
public ActionResult InsertBoxFromPopUp(Box Box_Client) { Box Box_Check = db.Box.Where(s => s.BoxName == Box_Client.BoxName.Trim()).FirstOrDefault(); if (Box_Check != null) { // TempData["AlreadyInsert"] = "Box Already Added. Choose different Box. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } Box Box_Return = new Box(); try { Box_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); Box_Client.CreatedDate = AppUtils.GetDateTimeNow(); Box_Return = db.Box.Add(Box_Client); db.SaveChanges(); if (Box_Return.BoxID > 0) { // TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, Box = Box_Return }, JsonRequestBehavior.AllowGet)); } else { // TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public JsonResult InsertAccountListVsAmountTransfer(AccountListVsAmountTransfer AccountListVsAmountTransferDetails) { try { AccountListVsAmountTransferDetails.CreateBy = AppUtils.GetLoginUserID(); AccountListVsAmountTransferDetails.CreateDate = AppUtils.GetDateTimeNow(); AccountListVsAmountTransferDetails.Status = AppUtils.TableStatusIsActive; AccountListVsAmountTransferDetails.CurrencyID = 1; var FromAccountForAmountChange = db.AccountList.Where(s => s.AccountListID == AccountListVsAmountTransferDetails.FromAccountID).FirstOrDefault(); var ToAccountForAmountChange = db.AccountList.Where(s => s.AccountListID == AccountListVsAmountTransferDetails.ToAccountID).FirstOrDefault(); FromAccountForAmountChange.InitialBalance = (FromAccountForAmountChange.InitialBalance - AccountListVsAmountTransferDetails.Amount); ToAccountForAmountChange.InitialBalance = (ToAccountForAmountChange.InitialBalance + AccountListVsAmountTransferDetails.Amount); db.Entry(FromAccountForAmountChange).State = System.Data.Entity.EntityState.Modified; db.Entry(ToAccountForAmountChange).State = System.Data.Entity.EntityState.Modified; db.AccountListVsAmountTransfer.Add(AccountListVsAmountTransferDetails); db.SaveChanges(); if (AccountListVsAmountTransferDetails.AccountListVsAmountTransferID > 0) { AccountListVsAmountTransfer AccountListVsAmountTransferIn = new AccountListVsAmountTransfer(); AccountListVsAmountTransfer AccountListVsAmountTransferOut = new AccountListVsAmountTransfer(); SetInOutDateDuringCreate(ref AccountListVsAmountTransferIn, ref AccountListVsAmountTransferOut, AccountListVsAmountTransferDetails); db.AccountListVsAmountTransfer.Add(AccountListVsAmountTransferIn); db.AccountListVsAmountTransfer.Add(AccountListVsAmountTransferOut); db.SaveChanges(); } return(Json(new { success = true }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertProductStatusFromPopUp(ProductStatus ProductStatus_Client) { ProductStatus ProductStatus_Check = db.ProductStatus.Where(s => s.ProductStatusName == ProductStatus_Client.ProductStatusName.Trim()).FirstOrDefault(); if (ProductStatus_Check != null) { // TempData["AlreadyInsert"] = "ProductStatus Already Added. Choose different ProductStatus. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } ProductStatus ProductStatus_Return = new ProductStatus(); try { ProductStatus_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); ProductStatus_Client.CreatedDate = AppUtils.GetDateTimeNow(); ProductStatus_Return = db.ProductStatus.Add(ProductStatus_Client); db.SaveChanges(); if (ProductStatus_Return.ProductStatusID > 0) { // TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, ProductStatus = ProductStatus_Return }, JsonRequestBehavior.AllowGet)); } else { // TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public void Delete(DatabaseConnection dbConn) { if (this.EmpID > 0) { // Reminder, keep the record to prevent re-generate the same entry from reminder procedure this.InboxDeleteDate = AppUtils.ServerDateTime(); db.update(dbConn, this); } else { string uploadFolder = uploadFolder = AppUtils.GetDocumentUploadFolder(dbConn); DBFilter attachmentFilter = new DBFilter(); attachmentFilter.add(new Match("InboxID", this.InboxID)); System.Collections.ArrayList attachmentList = EInboxAttachment.db.select(dbConn, attachmentFilter); foreach (EInboxAttachment attachment in attachmentList) { try { string UploadFile = System.IO.Path.Combine(uploadFolder, attachment.InboxAttachmentStoredFileName); if (System.IO.File.Exists(UploadFile)) { System.IO.File.Delete(UploadFile); } } catch { } finally { EInboxAttachment.db.delete(dbConn, attachment); } } db.delete(dbConn, this); } }
public DataView loadData(ListInfo info, DBManager db, Repeater repeater) { DBFilter filter = binding.createFilter(); //if (info != null && info.orderby != null && !info.orderby.Equals("")) // filter.add(info.orderby, info.order); filter.add(WebUtils.AddRankFilter(Session, "e.EmpID", true)); // only staffs with commission calculation is configured through latest Recurring Payment DBTerm m_inCondition = CreateFilterByProcess(gProcessName, gPID); if (m_inCondition != null) { filter.add(m_inCondition); } string select = "e.* "; string from = "from [" + db.dbclass.tableName + "] e "; DBFilter empInfoFilter = EmployeeSearchControl1.GetEmpInfoFilter(AppUtils.ServerDateTime(), AppUtils.ServerDateTime()); empInfoFilter.add(new MatchField("e.EmpID", "ee.EmpID")); filter.add(new Exists(EEmpPersonalInfo.db.dbclass.tableName + " ee", empInfoFilter)); DataTable table = filter.loadData(dbConn, null, select, from); table = EmployeeSearchControl1.FilterEncryptedEmpInfoField(table, info); view = new DataView(table); ListFooter.Refresh(); if (repeater != null) { repeater.DataSource = view; repeater.DataBind(); } return(view); }
private void GetNewArticle() { AppUtils.FlurryLog("NewArticle"); //this.titleControl.TitleOutAnimation(); if (this.popup.IsOpen == true) { this.floatPopup.FloatOutStoryboard.Begin(); } DisableAppBar(); this.is_freshing = true; Dispatcher.BeginInvoke(() => { GC.Collect(); this.scroll.IsHitTestVisible = false; this.progressBar.Visibility = Visibility.Visible; foreach (var item in this.content.Children) { item.Opacity = 0.25; } }); if (apiManager.isLogin) { apiManager.GetNextArticle(); } else { apiManager.GetRandomArticle(); } }
public ActionResult InsertTimePeriodForSignal(TimePeriodForSignal TimePeriodForSignal_Client) { TimePeriodForSignal TimePeriodForSignal_Check = db.TimePeriodForSignal.Where(s => s.SignalSign == TimePeriodForSignal_Client.SignalSign).FirstOrDefault(); if (TimePeriodForSignal_Check != null) { TempData["AlreadyInsert"] = "Time Period For Signal Already Added. Choose different TimePeriodForSignal. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } TimePeriodForSignal TimePeriodForSignal_Return = new TimePeriodForSignal(); try { TimePeriodForSignal_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); TimePeriodForSignal_Client.CreatedDate = AppUtils.GetDateTimeNow(); TimePeriodForSignal_Return = db.TimePeriodForSignal.Add(TimePeriodForSignal_Client); db.SaveChanges(); if (TimePeriodForSignal_Return.TimePeriodForSignalID > 0) { TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, TimePeriodForSignal = TimePeriodForSignal_Return }, JsonRequestBehavior.AllowGet)); } else { TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertZone(Zone Zone_Client) { Zone Zone_Check = db.Zone.Where(s => s.ZoneName == Zone_Client.ZoneName.Trim()).FirstOrDefault(); if (Zone_Check != null) { // TempData["AlreadyInsert"] = "Zone Already Added. Choose different Zone. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } Zone Zone_Return = new Zone(); try { Zone_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); Zone_Client.CreatedDate = AppUtils.GetDateTimeNow(); Zone_Return = db.Zone.Add(Zone_Client); db.SaveChanges(); if (Zone_Return.ZoneID > 0) { // TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, Zone = Zone_Return }, JsonRequestBehavior.AllowGet)); } else { // TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertSupplierFromPopUp(Supplier Supplier_Client) { Supplier Supplier_Check = db.Supplier.Where(s => s.SupplierName == Supplier_Client.SupplierName.Trim()).FirstOrDefault(); if (Supplier_Check != null) { // TempData["AlreadyInsert"] = "Supplier Already Added. Choose different Supplier. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } Supplier Supplier_Return = new Supplier(); try { Supplier_Client.CreatedBy = AppUtils.GetLoginEmployeeName(); Supplier_Client.CreatedDate = AppUtils.GetDateTimeNow(); Supplier_Return = db.Supplier.Add(Supplier_Client); db.SaveChanges(); if (Supplier_Return.SupplierID > 0) { // TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, Supplier = Supplier_Return }, JsonRequestBehavior.AllowGet)); } else { // TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertMikrotik(Mikrotik Mikrotik_Client) { Mikrotik Mikrotik_Check = db.Mikrotik.Where(s => s.RealIP == Mikrotik_Client.RealIP.Trim()).FirstOrDefault(); if (Mikrotik_Check != null) { TempData["AlreadyInsert"] = "Mikrotik Already Added. Choose different Mikrotik. "; return(Json(new { SuccessInsert = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } Mikrotik Mikrotik_Return = new Mikrotik(); try { Mikrotik_Client.CreatedBy = int.Parse(Session["LoggedUserID"].ToString()); Mikrotik_Client.CreatedDate = AppUtils.GetDateTimeNow(); Mikrotik_Return = db.Mikrotik.Add(Mikrotik_Client); db.SaveChanges(); if (Mikrotik_Return.MikrotikID > 0) { TempData["SaveSucessOrFail"] = "Save Successfully."; return(Json(new { SuccessInsert = true, Mikrotik = Mikrotik_Return }, JsonRequestBehavior.AllowGet)); } else { TempData["SaveSucessOrFail"] = "Save Failed."; return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } } catch { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
protected void btUpload_Click(object sender, EventArgs e) { if (fuFileUpload.PostedFile == null || fuFileUpload.PostedFile.ContentLength == 0) { Message.Alert(Page, "Bạn chưa chọn file!"); return; } MediaFile _MediaFile = new MediaFile(); _MediaFile.Name = AppUtils.MediaFileName(fuFileUpload.PostedFile.FileName.ToLower()); _MediaFile.Ext = Path.GetExtension(_MediaFile.Name).Replace(".", ""); _MediaFile.Path = GetPath() + _MediaFile.Name; _MediaFile.Size = fuFileUpload.PostedFile.ContentLength; _MediaFile.UserID = AppUtils.UserID(); _MediaFile.Description = txtDescription.Text.Trim(); _MediaFile.Tags = txtTags.Text.Trim(); var _NewsMedia = new NewsMedia(); _NewsMedia.NewsID = AppUtils.Request("id"); _NewsMedia.Order = Convert.ToInt32(txtOrder.Text.Trim()); try { fuFileUpload.SaveAs(Server.MapPath(Constant.MEDIA_PATH + _MediaFile.Path)); _MediaFile.Add(); _NewsMedia.FileID = _MediaFile.FileID; _NewsMedia.Add(); Response.Redirect(Request.Url.ToString()); } catch { Message.Alert(Page, "Có lỗi khi upload file!"); } }
/// <summary> /// Gets the Navigate URL for the link of variable (wt_Link9) /// </summary> /// <returns>The Navigate URL of the link variable (wt_Link9)</returns> public string lnk_Link9_NavigateUrl() { string navUrl = ""; string urlParameter = AppInfo.GetAppInfo().GetURLParameter(); if ((heContext.AppInfo.eSpaceId != Global.eSpaceId) || (this.Page is IEmailScreen)) { navUrl = GetClientRedirectionUrlBasePath(Global.App.IsForcingSecurityForScreens(), AppUtils.Instance.getImagePath(), "", ""); } else { string pageHeader = heContext.OsISAPIFilter.GetPage(Request); if (pageHeader != null && pageHeader.IndexOf('/', 1) != -1) { navUrl = AppUtils.Instance.getImagePath(/*forInternalUse*/ false, /*includeSessionIdIfNeeded*/ false); } } List <Pair <string, string> > parameters = new List <Pair <string, string> >(); parameters.Add(new Pair <string, string>(urlParameter, (string)null)); navUrl += AppUtils.GetPageName(heContext, Global.eSpaceId, "Contact_List", parameters); return(navUrl); }
protected void btImageUpload_Click(object sender, EventArgs e) { // Kiểm tra đã tạo thư mục lưu ảnh, dạng thư mục yyyy/mm/dd/newsid/ if (!AppUtils.CheckPath(lblMediaPathFull.Text)) { Message.Alert(Page, "Không tạo được thư mục lưu trữ ảnh, vui lòng báo người quản trị!"); return; } if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.ContentLength > 0) { Upload(FileUpload1, txtImageDescription1, cbIsAvatar1); } if (FileUpload2.PostedFile != null && FileUpload2.PostedFile.ContentLength > 0) { Upload(FileUpload2, txtImageDescription2, cbIsAvatar2); } if (FileUpload3.PostedFile != null && FileUpload3.PostedFile.ContentLength > 0) { Upload(FileUpload3, txtImageDescription3, cbIsAvatar3); } if (FileUpload4.PostedFile != null && FileUpload4.PostedFile.ContentLength > 0) { Upload(FileUpload4, txtImageDescription4, cbIsAvatar4); } if (FileUpload5.PostedFile != null && FileUpload5.PostedFile.ContentLength > 0) { Upload(FileUpload5, txtImageDescription5, cbIsAvatar5); } BindMedia(); }
protected void btReject_Click(object sender, EventArgs e) { if (drpCate1.SelectedValue == "0") { Message.Alert(Page, "Bạn chưa chọn chuyên mục xuất bản!"); return; } News _News = new News() { NewsID = AppUtils.Request("id") }; _News = _News.Get(); _News.Title = txtTitle.Text.Trim(); _News.SubTitle = txtSubTitle.Text.Trim(); _News.ImageUrl = imgImageUrl.ImageUrl.Replace(Constant.MEDIA_PATH, ""); _News.Lead = txtLead.Text.Trim(); _News.SubLead = txtSubLead.Text.Trim(); _News.Content = ftbContent.Text.Trim(); _News.IsPhoto = chkIsPhoto.Checked; _News.IsVideo = chkIsVideo.Checked; _News.IsAudio = chkIsAudio.Checked; _News.PublishedTime = Convert.ToDateTime(txtPublishTime.Text); _News.CateID = Convert.ToInt32(drpCate1.SelectedValue); if (_News.Status > 1) { _News.Status = _News.Status - 1; } _News.UserID = AppUtils.UserID(); _News.Tags = txtTags.Text.Trim(); _News.Update(); UpdatePublish(); Redirect(); }
public JsonResult InsertMeasurementUnit(MeasurementUnits measureUnit) { try { db.MeasurementUnits.Add(measureUnit); measureUnit.CreateBy = AppUtils.GetLoginUserID(); measureUnit.CreateDate = AppUtils.GetDateTimeNow(); measureUnit.Status = AppUtils.TableStatusIsActive; db.SaveChanges(); CustomMeasuremetUnit UnitInfo = new CustomMeasuremetUnit { MeasurementUnitID = measureUnit.MeasurementUnitID, UnitName = measureUnit.UnitName, UpdateMeasurementUnit = ISP_ManagementSystemModel.AppUtils.HasAccessInTheList(ISP_ManagementSystemModel.AppUtils.Update_Measurement_Unit) ? true : false, }; return(Json(new { SuccessInsert = true, UnitInfo = UnitInfo }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult SaveAdvanceAmount(int ClientDetailsID, int Amount, string Remarks) { //db.Entry(new Transaction()).CurrentValues.SetValues(new Transaction()); AdvancePayment advancePayment = db.AdvancePayment.Where(s => s.ClientDetailsID == ClientDetailsID).FirstOrDefault(); try { if (advancePayment != null) { advancePayment.UpdatePaymentBy = AppUtils.GetLoginEmployeeName(); advancePayment.UpdatePaymentDate = AppUtils.GetDateTimeNow(); advancePayment.AdvanceAmount += Amount; advancePayment.Remarks = Remarks; db.Entry(advancePayment).State = EntityState.Modified; db.SaveChanges(); } else { AdvancePayment insertAdvancePayment = new AdvancePayment(); insertAdvancePayment.ClientDetailsID = ClientDetailsID; insertAdvancePayment.AdvanceAmount = Amount; insertAdvancePayment.Remarks = Remarks; insertAdvancePayment.CreatePaymentBy = AppUtils.GetLoginEmployeeName(); insertAdvancePayment.FirstPaymentDate = AppUtils.GetDateTimeNow(); db.AdvancePayment.Add(insertAdvancePayment); db.SaveChanges(); } return(Json(new { Success = true }, JsonRequestBehavior.AllowGet)); } catch { return(Json(new { Success = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult InsertCompanyFromPopUp(FormCollection form, HttpPostedFileBase CompanyImage) { Company client_Company_info = JsonConvert.DeserializeObject <Company>(form["CompanyDetails"]); Company db_Company_Check = db.Company.Where(s => s.CompanyName.ToLower() == client_Company_info.CompanyName.ToLower().Trim() && s.Status != AppUtils.TableStatusIsDelete).FirstOrDefault(); if (db_Company_Check != null) { return(Json(new { success = false, AlreadyInsert = true }, JsonRequestBehavior.AllowGet)); } Company CompanyReturn = new Company(); try { client_Company_info.Status = AppUtils.TableStatusIsActive; client_Company_info.CreateBy = AppUtils.GetLoginUserID(); //Company_info.CreateBy = AppUtils.GetLoginEmployeeName(); client_Company_info.CreateDate = AppUtils.GetDateTimeNow(); CompanyReturn = db.Company.Add(client_Company_info); db.SaveChanges(); SaveImageInFolderAndAddInformationInCompanyTable(ref client_Company_info, "LOGO", CompanyImage); if (CompanyReturn.CompanyID > 0) { db.SaveChanges(); return(Json(new { success = true, }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult ChangePassword(string origin_password, string new_password, string re_new_password) { using (var db = new TravelEntities()) { int userID = Convert.ToInt16(Session["UserId"]); T_Users user = db.T_Users.Where(a => a.UserID == userID).FirstOrDefault(); if (user != null) { if (AppUtils.SHA1Hash(origin_password).Equals(user.Password)) { if (new_password.Equals(re_new_password)) { user.Password = AppUtils.SHA1Hash(new_password); db.T_Users.Attach(user); db.Entry(user).State = System.Data.Entity.EntityState.Modified; db.SaveChanges(); } return(RedirectToAction("Login", new { message = 0 })); } else { return(RedirectToAction("Login", new { message = -1 })); } } else { return(RedirectToAction("Login")); } } }
public override string ActualBankFileName() { string m_filename; EBankFileDailySeq m_seq = EBankFileDailySeq.GetObject(dbConn, "UOB", AppUtils.ServerDateTime().Date); if (m_seq != null) { m_seq.BankFileSeq++; // seq mod 100 to make sure a 3-digits number remains in 2-digits m_filename = "UIAI" + processDateTime.ToString("ddMM") + (m_seq.BankFileSeq % 100).ToString("00") + BankFileExtension(); EBankFileDailySeq.db.update(dbConn, m_seq); } else { m_filename = "UIAI" + processDateTime.ToString("ddMM") + "01" + BankFileExtension(); m_seq = new EBankFileDailySeq(); m_seq.BankCode = "UOB"; m_seq.BankFileDate = AppUtils.ServerDateTime().Date; m_seq.BankFileSeq = 1; EBankFileDailySeq.db.insert(dbConn, m_seq); } return(m_filename); }
public static string HandleChooseFolderComboBox(ComboBoxEdit comboBox, ButtonPressedEventArgs args, bool showNewFolderBtn, string description, IWin32Window owner) { if ((ButtonPredefines)args.Button.Kind == ButtonPredefines.Ellipsis) { string startFolderPath = null; if (!string.IsNullOrEmpty(comboBox.Text)) { if (Directory.Exists(comboBox.Text)) { startFolderPath = comboBox.Text; } } string folderPath = AppUtils.ChooseFolder(startFolderPath, showNewFolderBtn, description, owner); if (folderPath != null) { comboBox.Text = folderPath; return(folderPath); } } return(null); }
public JsonResult InsertVendorType(VendorType vendorType) { try { db.VendorTypes.Add(vendorType); vendorType.CreateBy = AppUtils.GetLoginUserID(); vendorType.CreateDate = AppUtils.GetDateTimeNow(); vendorType.Status = AppUtils.TableStatusIsActive; db.SaveChanges(); VendorTypeViewModel vendorTypeView = new VendorTypeViewModel { VendorTypeID = vendorType.VendorTypeID, VendorTypeName = vendorType.VendorTypeName, UpdateVendorType = ISP_ManagementSystemModel.AppUtils.HasAccessInTheList(ISP_ManagementSystemModel.AppUtils.Update_Vendor_Type) ? true : false, }; return(Json(new { SuccessInsert = true, vendorTypeView = vendorTypeView }, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json(new { SuccessInsert = false }, JsonRequestBehavior.AllowGet)); } }