public bool Login(AccountLoginModel objAccountLoginModel) { using (var context = new QuanLyDeTaiKhoaHocContext()) { Quyen quyenAccount = context.Quyens.FirstOrDefault(x => x.Deleted == false && x.MaQuyen == objAccountLoginModel.Quyen); if (quyenAccount == null) { return(false); } else { objAccountLoginModel.MatKhau = CommonLibrary.CreateMD5(objAccountLoginModel.MatKhau); Account account = context.Accounts.FirstOrDefault(x => x.Deleted == false && x.TenDangNhap == objAccountLoginModel.TenDangNhap && x.MatKhau.ToLower() == objAccountLoginModel.MatKhau.ToLower() && x.QuyenAccounts.Any(y => y.Deleted == false && y.Id == quyenAccount.Id)); if (account != null) { SystemConfiguration.SystemConfiguration.TenDayDu = account.TenDayDu; return(true); } else { return(false); } } } }
public string checkAuthorizedLimitWithError(decimal amount, string FROM_CTRY_CD, string FROM_CRCY_CD, string MNYT_TCD, bool fromCheckIND) { string mnytTCD = MNYT_TCD; if (fromCheckIND) { mnytTCD = "1"; } string checkTransAmt = checkAuthorizedAmount(amount, FROM_CTRY_CD, FROM_CRCY_CD, mnytTCD); if (string.IsNullOrWhiteSpace(checkTransAmt)) { return(CommonLibrary.displayGenericErrorMessage()); } else if (checkTransAmt == "no_paykap_service_in_selected_country") { return("Il se pourrait que PayKap n'a pas de service de transfert dans le pays selectionné."); } else if (checkTransAmt == "unauthorized") { decimal maxAmtAuth = getAuthorizedAmount(FROM_CTRY_CD, FROM_CRCY_CD, MNYT_TCD); string strMaxAmtAuth = FROM_CRCY_CD.ToUpper() + " " + maxAmtAuth.ToString("N2"); if (maxAmtAuth == -0.0m) { return(CommonLibrary.displayGenericErrorMessage()); } return("Le montant de la transaction est supérieur à la limite autorisée (" + strMaxAmtAuth + ") dans votre pays."); } return("continue"); }
public bool ForgetPassword(AccountForgetModel m_objAccountForgetModel) { using (var context = new QuanLyDeTaiKhoaHocContext()) { var data = context.Accounts.FirstOrDefault(x => x.Deleted == false && x.Email == m_objAccountForgetModel.Email && x.TenDangNhap == m_objAccountForgetModel.TenDangNhap); if (data == null) { return(false); } else { MailInfo mailInfoFrom = new MailInfo() { Email = Constants.MAIL_EMAIL_DEFAULT, Name = Constants.MAIL_NAME_DEFAULT, Pass = Constants.MAIL_PASSWORD_DEFAULT }; MailInfo mailInfoTo = new MailInfo() { Email = data.Email }; string strNewPassword = EmailMethod.RandomPassword(); string strMD5NewPassword = CommonLibrary.CreateMD5(strNewPassword); data.MatKhau = strMD5NewPassword; context.SaveChanges(); string content = $"Quản Lý Đề Tài Khoa Học cấp lại mật khẩu.\r\n\r\nTên đăng nhập: {data.TenDangNhap}\r\nMật khẩu: {strNewPassword}"; EmailMethod.SendMail("Cấp lại mật khẩu - Quản Lý Đề Tài Khoa Học", content, mailInfoFrom, mailInfoTo); return(true); } } }
// Use this for initialization void Start() { if (Instance == null) { Instance = this; } victory = false; characterDataNew = PlayerPrefsCharacterSaver.Instance.CustomAction('L', null); //load it totalShields = characterDataNew.totalShields; //var textPlayerName = GameObject.Find("PlayerName").GetComponent<Text>(); //textPlayerName.text = characterDataNew.characterName.ToString(); //set the saved value if exists. //TODO: this has a bug, solve id pending... //var textAmmo = GameObject.Find("AmmoCount").GetComponent<Text>(); //textPlayerName.text = characterDataNew.Ammo.ToString(); //set the saved value if exists. //TODO: this has a bug, solve id pending... if (GameObject.Find("PlayerName") != null) //validate if object label text exists { Text textNombreJugador = GameObject.Find("PlayerName").GetComponent <Text>(); textNombreJugador.text = ""; //clear the text //characterDataVal = PlayerPrefsCharacterSaver.Instance.CustomAction('L', null); //load it //TODO: usar el método de arriba para recoger el nombre del jugador, es mucho más elegante. var characterName = PlayerPrefs.GetString("characterName_CharacterSlot" + 0); textNombreJugador.text = characterName; } }
public List <BusinessCommissionTransaction> getAllSelectedMonthBusinessCommissionTransaction(int BN, string month, string year) { var list = new List <BusinessCommissionTransaction>(); try { int intMonth = Convert.ToInt32(month); int intYear = Convert.ToInt32(year); DateTime firstDate = CommonLibrary.StartOfMonth(intYear, intMonth); DateTime lastDate = CommonLibrary.EndOfMonth(intYear, intMonth); var query = from busTrans in db.TBUS_CMSN_TRANS join trans in db.TTRANS_TRSF_CRDT_DBT on busTrans.TRANS_ID equals trans.TRANS_ID join busUsr in db.TBUS_USR on busTrans.BUS_USR_NBR equals busUsr.BUS_USR_NBR where (busUsr.BN == BN && trans.TRANS_SCD == "06" && trans.TRANS_CDT >= firstDate && trans.TRANS_CDT <= lastDate) orderby trans.TRANS_ID descending select busTrans; foreach (var item in query) { list.Add(item); } return(list); } catch { return(list); } }
public List <BusinessCommissionTransaction> getAllCurrentMonthBusinessCommissionTransaction(int BN) { var list = new List <BusinessCommissionTransaction>(); try { DateTime startDT = CommonLibrary.StartOfMonth(DateTime.Now); var query = from busTrans in db.TBUS_CMSN_TRANS join trans in db.TTRANS_TRSF_CRDT_DBT on busTrans.TRANS_ID equals trans.TRANS_ID join busUsr in db.TBUS_USR on busTrans.BUS_USR_NBR equals busUsr.BUS_USR_NBR where (busUsr.BN == BN && trans.TRANS_SCD == "06" && trans.TRANS_CDT >= startDT) orderby trans.TRANS_ID descending select busTrans; foreach (var item in query) { list.Add(item); } return(list); } catch { return(list); } }
public static void Login(IWebDriver driver, string Url, string UserId, string Password) { driver.Navigate().GoToUrl(Url); CommonLibrary.SetOperationsOnControls(driver, "set", "Id", "hitComp_msLogin_id", UserId); CommonLibrary.SetOperationsOnControls(driver, "set", "Id", "hitComp_msLogin_password", Password); CommonLibrary.SetOperationsOnControls(driver, "click", "XPath", "//*[@id='hitComp_msLogin_form']/table/tbody/tr[3]/td/input", ""); System.Threading.Thread.Sleep(3000); }
public void Initialize() { this.googleCategoryService = new Mock <IGoogleCategoryService>(); this.indigoCategoryService = new Mock <IIndigoCategoryService>(); this.inputDataProvider = new Mock <IInputDataProvider>(); this.logger = CommonLibrary.SetupLogger(); this.pathResolver = new Mock <PathResolver>(); }
private static void InitializeContainer(Container container) { container.Register <ILoggingService, LoggingService>(Lifestyle.Singleton); CommonLibrary.RegisterDependencyInjection(container); container.Register <IPatientsControllerService, PatientsControllerService>(Lifestyle.Singleton); container.Register <IConquestControllerService, ConquestControllerService>(Lifestyle.Singleton); container.Register <LogRequestAndResponseHandler, LogRequestAndResponseHandler>(Lifestyle.Singleton); container.Register <IAccountsControllerService, AccountsControllerService>(Lifestyle.Singleton); }
public override System.Collections.Generic.List<SitemapUrl> GetUrls(int portalId, CommonLibrary.Entities.Portal.PortalSettings ps, string version) { List<SitemapUrl> urls = new List<SitemapUrl>(); for (int i = 0; i <= 50; i++) { urls.Add(GetPageUrl(i)); } return urls; }
public override void Insert(string Key, object Value, CommonLibrary.Services.Cache.CacheDependency Dependency, System.DateTime AbsoluteExpiration, System.TimeSpan SlidingExpiration, CacheItemPriority Priority, CacheItemRemovedCallback OnRemoveCallback) { CommonLibrary.Services.Cache.CacheDependency d = Dependency; if (IsWebFarm()) { string[] f = new string[1]; f[0] = GetFileName(Key); CreateCacheFile(f[0], Key); d = new CommonLibrary.Services.Cache.CacheDependency(f, null, Dependency); } base.Insert(Key, Value, d, AbsoluteExpiration, SlidingExpiration, Priority, OnRemoveCallback); }
public static Result <string, string> Combine(this Result <string, string> x, params Func <string, Result <string, string> >[] switches) { if (x.IsFailure) { return(x); } var success = x as Result <string, string> .Success; Func <string, string, string> addSuccess = (a, b) => a; Func <string, string, string> addFailure = (f1, f2) => string.Format("{0}{1}{2}", f2, Environment.NewLine, f1); return(CommonLibrary.Combine(success.Value, addSuccess, addFailure, switches)); }
public List <AgentTransfer> getAllCurrentMonthAgentTransferByAgentID(int agntID) { var list = new List <AgentTransfer>(); try { DateTime startDT = CommonLibrary.StartOfMonth(DateTime.Now); return(db.TAGNT_TRSF.Where(x => x.AGNT_ID == agntID && x.AGNT_TRSF_DT >= startDT).OrderByDescending(x => x.AGNT_TRSF_DT).ToList()); } catch { return(list); } }
public static Result <string, string> Plus(this Result <string, string> x, Func <string, Result <string, string> > switch1, Func <string, Result <string, string> > switch2) { if (x.IsFailure) { return(x); } var success = x as Result <string, string> .Success; Func <string, string, string> addSuccess = (a, b) => a; Func <string, string, string> addFailure = (f1, f2) => String.Format("{0}{1}{2}", f2, Environment.NewLine, f1); return(CommonLibrary.Plus(addSuccess, addFailure, switch1, switch2, success.Value)); }
// Use this for initialization void Start() { if (Instance == null) { Instance = this; } totalShields = characterDataNew.totalShields; characterDataNew = PlayerPrefsCharacterSaver.Instance.CustomAction('L', null); //save it var textPlayerName = GameObject.Find("PlayerName").GetComponent <Text>(); textPlayerName.text = characterDataNew.characterName.ToString(); //set the saved value if exists. //TO DO: this has a bug, solve id pending... var textAmmo = GameObject.Find("AmmoCount").GetComponent <Text>(); textPlayerName.text = characterDataNew.Ammo.ToString(); //set the saved value if exists. //TO DO: this has a bug, solve id pending... }
static void Main(string[] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); //try { CommonLibrary lib = new CommonLibrary(); string consoleConfig = Application.ExecutablePath + ".config"; if (!System.IO.File.Exists(consoleConfig)) lib.CreateAppConfig(consoleConfig, _clientIdName); Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath); KeyValueConfigurationElement kv = config.AppSettings.Settings[_clientIdName]; if (kv == null) { config.AppSettings.Settings.Add(_clientIdName, ""); kv = config.AppSettings.Settings[_clientIdName]; } string clientId = kv.Value; if (clientId == "") { clientId = Guid.NewGuid().ToString(); config.AppSettings.Settings[_clientIdName].Value = clientId; config.Save(); } string tmpClientId = lib.GetArgument("/i:", args); if (tmpClientId != "") clientId = tmpClientId; try { lib.CheckId(clientId); string configLocation = lib.GetArgument("/c:", args); if (!File.Exists(configLocation) & configLocation != "") throw new Exception("Config location not found"); string scriptFile = lib.GetArgument("/s:", args); if (!File.Exists(scriptFile) & scriptFile != "") throw new Exception("Script file not found"); string logFile = lib.GetArgument("/f:", args); if (logFile != "") { FileInfo fi = new FileInfo(logFile); if (!fi.Directory.Exists) throw new Exception("Log file path not found"); } int logLevel = 0; string lol = lib.GetArgument("/l:", args); if (lol != "" && !int.TryParse(lol, out logLevel)) throw new Exception("LogLevel should be numeric"); _appContext = new AppContext(clientId, configLocation, scriptFile, logFile, logLevel); Application.Run(_appContext); } catch (TrappedException) { MessageBox.Show("The Client Id supplied is not valid, blank the TycTak.Exe.Config element for key '" + _clientIdName + "' and make sure you do not pass in a client id using the /i argument prefix, and start again", "Unable to continue", MessageBoxButtons.OK, MessageBoxIcon.Error); } //} catch (Exception ex) { // MessageBox.Show("Unknown error occurred\r\n\r\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); //} }
public Account createNewBusinessAgencyAccount(int bn, string adminUserNBR, string langCD) { try { var newAcct = new Account(); var bus = db.TBUS.Find(bn); if (bus == null) { return(null); } //get Account currency var acct = db.TACCT.Find(bus.ACCT_ID); if (acct == null) { return(null); } string crcyCD = acct.CRCY_CD; string busAcctNbr = acct.ACCT_NBR; string ctryCD = busAcctNbr.Substring(9, 3); string acctCulInfo = acct.ACCT_CLTR_INFO; //generate client account number int currentLength = db.TBUS_AGCY.Where(x => x.BN == bn).Count(); string acctNbr = bn + "" + ctryCD + CommonLibrary.generateStringCode(5, currentLength); if (string.IsNullOrWhiteSpace(acctNbr) || acctNbr.Length != 17) { throw new Exception(); } newAcct.ACCT_TCD = "2"; newAcct.CRCY_CD = crcyCD; newAcct.ACCT_SCD = "01"; newAcct.ACCT_NBR = acctNbr; newAcct.ACCT_NAME = "Compte Courant Affaire"; newAcct.ACCT_BAL = 0.0m; newAcct.ACCT_CLTR_INFO = acctCulInfo; newAcct.LGC_DEL_IND = "0"; newAcct.USR_NBR = adminUserNBR; newAcct.ACCT_CDT = DateTime.Now; return(newAcct); } catch { return(null); } }
public List <AgentTransfer> getAllSelectedMonthAgentTransferByAgentID(int agntID, string month, string year) { var list = new List <AgentTransfer>(); try { int intMonth = Convert.ToInt32(month); int intYear = Convert.ToInt32(year); DateTime firstDate = CommonLibrary.StartOfMonth(intYear, intMonth); DateTime lastDate = CommonLibrary.EndOfMonth(intYear, intMonth); return(db.TAGNT_TRSF.Where(x => x.AGNT_ID == agntID && x.AGNT_TRSF_DT >= firstDate && x.AGNT_TRSF_DT <= lastDate).OrderByDescending(x => x.AGNT_TRSF_DT).ToList()); } catch { return(list); } }
public void Initialize() { googleCategoryServiceMock = new Mock <IGoogleCategoryService>(); this.loggerMock = new Mock <ILogger>(); this.loggerMock = CommonLibrary.SetupLogger(); this.InitMockCategories(); string input = @"# Google_Product_Taxonomy_Version: 2015-02-19 1 - Animals & Pet Supplies 3237 - Animals & Pet Supplies > Live Animals "; this.BuilderSetup(input); }
public async Task Navigate() { CompensateAdjustedDestination(); SetNavigationDirectionVector(); if (!CommonLibrary.IsNan(this.NavigationDirectionVector)) { //increment character DateTime startTime = DateTime.Now; Vector3 allowableDestinationVector = GetNearestAvailableIncrementalVectorTowardsDestination(); //Logging.LogManagerImpl.ForceLog("Moving from {0} to {1}", PositionBeingNavigated.Vector, allowableDestinationVector); DateTime endTime = DateTime.Now; Vector3 previousPosition = PositionBeingNavigated.Vector; PositionBeingNavigated.MoveTo(allowableDestinationVector); SynchronizeSecondaryPositions(previousPosition, PositionBeingNavigated.Vector); if (!this.IsKnockbackNavigation) { await Task.Delay(2); } } }
public List <SelectListItem> getUserAccountList(string usrNbr, string usrTCD, string selectedValue) { List <SelectListItem> items = new List <SelectListItem>(); var acctList = db.TACCT.Where(x => x.USR_NBR == usrNbr && x.ACCT_TCD == "1" && x.ACCT_SCD == "01").ToList(); if (acctList.Count() == 0) { return(null); } else { foreach (var item in acctList) { string bal = CommonLibrary.displayFormattedCurrency(item.ACCT_BAL, item.ACCT_CLTR_INFO); item.ACCT_NBR = formatAccountNumber(item.ACCT_NBR, usrTCD) + " - " + item.CRCY_CD.ToUpper() + " = " + bal; } var list = new SelectList(acctList, "ACCT_ID", "ACCT_NBR", selectedValue).ToList(); return(list); } }
/// <summary> /// 會員登入。 /// </summary> /// <param name="loginViewModel">登入資訊</param> public CommonLibrary.Member.MemberResult Post(CommonLibrary.Member.LoginViewModel loginViewModel) { var memberResult = new CommonLibrary.Member.MemberResult(); memberResult.Status = 1; try { ShoppingEntities entity = new ShoppingEntities(); var member = entity.Member.FirstOrDefault(r => r.Email == loginViewModel.Email); if (member == null) { memberResult.Status = 102; memberResult.ErrorMessage = "查無此帳號"; return memberResult; } var memberPassword = member.Password; var loginPassword = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(loginViewModel.Password, "SHA1"); if (memberPassword != loginPassword) { memberResult.Status = 101; memberResult.ErrorMessage = "帳號或密碼錯誤"; return memberResult; } memberResult.Data.MemberId = member.MemberId; memberResult.Data.Email = member.Email; memberResult.Data.Phone = member.Phone; memberResult.Data.MemberName = member.MemberName; memberResult.Data.Nickname = member.Nickname; memberResult.Data.MemberImage = member.MemberImage; } catch (Exception ex) { memberResult.Status = 99; memberResult.ErrorMessage = ex.Message; } return memberResult; }
/// <summary> /// 會員註冊。 /// </summary> /// <param name="registerViewModel">註冊資訊</param> public CommonLibrary.DataResult Post(CommonLibrary.Member.RegisterViewModel registerViewModel) { var dataResult = new CommonLibrary.DataResult(); dataResult.Status = 1; try { ShoppingEntities entity = new ShoppingEntities(); if (entity.Member.Any(r => r.Email == registerViewModel.Email)) { dataResult.Status = 100; dataResult.ErrorMessage = "EMail重複"; return dataResult; } if (entity.Member.Any(r => r.Phone == registerViewModel.Email)) { dataResult.Status = 101; dataResult.ErrorMessage = "手機號碼重複"; return dataResult; } var member = new EntityDataModel.Member(); member.MemberName = registerViewModel.MemberName; member.MemberImage = registerViewModel.MemberImage; member.Password = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(registerViewModel.Password, "SHA1"); member.Nickname = registerViewModel.Nickname; member.Phone = registerViewModel.Phone; member.Email = registerViewModel.Email; entity.Member.Add(member); entity.SaveChanges(); } catch (Exception ex) { dataResult.Status = 99; dataResult.ErrorMessage = ex.Message; } return dataResult; }
// Update is called once per frame void Update() { //get public var from other script: GameObject CommonLibraryObject = GameObject.Find("CommonLibrary"); CommonLibrary otroScript = CommonLibraryObject.GetComponent <CommonLibrary>(); if (Input.GetButtonDown("Jump")) { if (Time.time - lastStep > timeBetweenSteps) { lastStep = Time.time; //delay the player shot. //int FirePosition = transform.position + 5; //hga TODO: usar una posición más elevada para crear el disparo Instantiate(theBullet, transform.position, Quaternion.identity); SoundManager.Instance.PlayOneShot(SoundManager.Instance.bulletFire); } } if (otroScript.victory != true) { CommonLibrary.Instance.ModifyTextAlienCountUIScore(); // call once per frame count alien } CommonLibrary.Instance.CountShields(); // call once per frame count alien }
/* public AgencyTransactionClientData getClientData(string cardNbr, string phnNbr, string acctNbr, string acctTCD, string cardPhnAcctTCD) * { * try * { * var model = new AgencyTransactionClientData(); * var objAcct = new Account(); * var objCard = new Card(); * var objUsr = new User(); * var objUsrPhn = new UserPhoneLogin(); * string ACCT_NBR = null; * int ACCT_ID = 0; * string CRCY_CD = null; * string USR_FUL_NM = null; * string USR_NBR = null; * string UserId = null; * * if (cardPhnAcctTCD == "card") * { * var cardOwner = getCardOwnerByCardNbr(cardNbr); * var acctOwner = getAccountCardOwnerByCardNbr(cardNbr); * var cltUser = db.TUSR.Find(cardOwner.USR_NBR); * if (cltUser == null) * { * return null; * } * * ACCT_NBR = acctOwner.ACCT_NBR; * ACCT_ID = acctOwner.ACCT_ID; * CRCY_CD = acctOwner.CRCY_CD; * USR_FUL_NM = cltUser.USR_FUL_NM; * USR_NBR = acctOwner.USR_NBR; * UserId = cltUser.Id.TrimEnd(); * } * else if (cardPhnAcctTCD == "phn") * { * var getUserPhn = getOneValidUserPhoneLoginByPhnNbr(phnNbr); * if (getUserPhn == null) * { * return null; * } * * var getAcct = objAcct.getAccountByAcctID(getUserPhn.ACCT_ID); * var getUser = objUsr.getUserByUsrNbr(getUserPhn.USR_NBR); * if (getAcct == null || getUser == null) * { * return null; * } * * ACCT_NBR = getAcct.ACCT_NBR; * ACCT_ID = getAcct.ACCT_ID; * CRCY_CD = getAcct.CRCY_CD; * USR_FUL_NM = getUser.USR_FUL_NM; * USR_NBR = getUser.USR_NBR; * UserId = getUser.Id.TrimEnd(); * } * else if (cardPhnAcctTCD == "acct") * { * var getAcct = objAcct.getAccountByAcctNbr(acctNbr, "1"); * if (getAcct == null) * { * return null; * } * * var getUser = objUsr.getUserByUsrNbr(getAcct.USR_NBR); * if (getAcct == null || getUser == null) * { * return null; * } * * ACCT_NBR = getAcct.ACCT_NBR; * ACCT_ID = getAcct.ACCT_ID; * CRCY_CD = getAcct.CRCY_CD; * USR_FUL_NM = getUser.USR_FUL_NM; * USR_NBR = getUser.USR_NBR; * UserId = getUser.Id.TrimEnd(); * } * else * { * return null; * } * * if (string.IsNullOrWhiteSpace(ACCT_NBR) || ACCT_ID == 0 || string.IsNullOrWhiteSpace(CRCY_CD) || * string.IsNullOrWhiteSpace(USR_FUL_NM) || string.IsNullOrWhiteSpace(USR_NBR) || string.IsNullOrWhiteSpace(UserId)) * { * return null; * } * * model.CLT_CTRY_CD = ACCT_NBR.Substring(0, 3); * model.CLT_ACCT_ID = ACCT_ID; * model.CLT_CRCY_CD = CRCY_CD; * model.CLT_FUL_NM = USR_FUL_NM.ToUpper(); * model.CLT_USR_NBR = USR_NBR; * model.CLT_USR_ID = UserId; * return model; * } * catch * { * return null; * } * } */ public UserPhoneLogin getOneValidUserPhoneLoginByPhnNbr(string phnNbr) { if (!string.IsNullOrWhiteSpace(phnNbr)) { phnNbr = CommonLibrary.replaceWhiteSpace(phnNbr); } var usrPhnLoginList = db.TUSR_PHN_LGN.Where(x => x.USR_PHN_LGN_NBR == phnNbr && x.LGC_DEL_IND == "0").ToList(); if (usrPhnLoginList.Count() == 0) { return(null); } else { var usrPhnLogin = usrPhnLoginList[0]; if (usrPhnLogin == null) { return(null); } return(usrPhnLogin); } }
public ActionResult Login(CommonLibrary.Member.LoginViewModel loginViewModel) { if (ModelState.IsValid) { var loginController = new ShoppingWebAPI.Controllers.LoginController(); CommonLibrary.Member.MemberResult memberResult = loginController.Post(loginViewModel); if (memberResult.Status == 1) { //登入時清空所有 Session 資料 Session.RemoveAll(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, memberResult.Data.Nickname,//你想要存放在 User.Identy.Name 的值,通常是使用者帳號 DateTime.Now, DateTime.Now.AddMinutes(30), false,//將管理者登入的 Cookie 設定成 Session Cookie memberResult.Data.MemberId.ToString(),//userdata看你想存放啥 FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); //TempData["AlertMessage"] = "登入成功"; if (TempData["returnURL"] != null) return Redirect(TempData["returnURL"].ToString()); else return RedirectToRoute(new { controller = "Home", action = "Index" }); } else { TempData["AlertMessage"] = memberResult.ErrorMessage; return View(); } } return View(); }
public void GetInputSet_Test() { // Arrange string separator = ConfigurationManager.AppSettings["Separator"]; string lines = string.Format( @"5{0} indigobreadcrumb1{0} currentGoogleBreadCrumb1{0} newGoogleBreadCrumb1 7{0} indigobreadcrumb2{0} currentGoogleBreadCrumb2{0} newGoogleBreadCrumb2" , separator); var inputDataProvider = new InputDataProvider(() => new StringReader(lines), CommonLibrary.SetupLogger().Object); // Act var result = inputDataProvider.GetInputSet(); // Assert Assert.AreEqual(2, result.Count); var record1 = result[0]; Assert.AreEqual(5, record1.IndigoCategoryId); Assert.AreEqual("indigobreadcrumb1", record1.IndigoBreadcrumb); Assert.AreEqual("currentGoogleBreadCrumb1", record1.CurrentGoogleBreadcrumb); Assert.AreEqual("newGoogleBreadCrumb1", record1.NewGoogleBreadcrumb); var record2 = result[1]; Assert.AreEqual(7, record2.IndigoCategoryId); Assert.AreEqual("indigobreadcrumb2", record2.IndigoBreadcrumb); Assert.AreEqual("currentGoogleBreadCrumb2", record2.CurrentGoogleBreadcrumb); Assert.AreEqual("newGoogleBreadCrumb2", record2.NewGoogleBreadcrumb); }
protected void RaiseEvent_PopulateOnDemand(CommonLibrary.UI.WebControls.Common.Node objNode) { if (PopulateOnDemand != null) { PopulateOnDemand(new NavigationEventArgs(objNode.ID, objNode)); } }
public XmlCollectionBase(string strNamespace, CommonLibrary.UI.WebControls.Tree objTreeControl) { m_objTree = objTreeControl; InnerXMLDoc = new System.Xml.XmlDocument(); InnerXMLNode = InnerXMLDoc.CreateNode(XmlNodeType.Element, "root", ""); System.Xml.XmlAttribute objAttr = InnerXMLDoc.CreateAttribute("id"); objAttr.Value = strNamespace; InnerXMLNode.Attributes.Append(objAttr); InnerXMLDoc.AppendChild(InnerXMLNode); }
public List <SelectListItem> getUserPayKapBankAccountList(string usrNbr, string usrTCD, string selectedValue) { List <SelectListItem> items = new List <SelectListItem>(); var acctList = db.TACCT.Where(x => x.USR_NBR == usrNbr && x.ACCT_TCD == "1" && x.ACCT_SCD == "01").ToList(); var myList = db.TFI_EXRL_ACCT.Where(x => x.USR_NBR == usrNbr && x.EXRL_ACCT_FOR_CURT_USR_IND == "1").ToList(); if (acctList.Count() == 0 && myList.Count() == 0) { return(items); } if (acctList.Count() != 0) { items.Add(new SelectListItem { Text = "-------Mon compte PayKap-----------------", Value = "" }); foreach (var item in acctList) { string bal = CommonLibrary.displayFormattedCurrency(item.ACCT_BAL, item.ACCT_CLTR_INFO); item.ACCT_NBR = formatAccountNumber(item.ACCT_NBR, usrTCD) + " - " + item.CRCY_CD.ToUpper() + " = " + bal; string strACCT_ID = "PKP" + Convert.ToString(item.ACCT_ID); if (strACCT_ID == selectedValue) { items.Add(new SelectListItem { Text = item.ACCT_NBR, Value = strACCT_ID, Selected = true }); } else { items.Add(new SelectListItem { Text = item.ACCT_NBR, Value = strACCT_ID, Selected = false }); } } //var list = new SelectList(acctList, "ACCT_ID", "ACCT_NBR", selectedValue).ToList(); } if (myList.Count() != 0) { items.Add(new SelectListItem { Text = "", Value = "" }); items.Add(new SelectListItem { Text = "-------Mes comptes bancaires-------------", Value = "" }); foreach (var item in myList) { item.RCPT_USR_BUS_NM = item.EXRL_ACCT_NBR + " - " + item.CRCY_CD; string strEXRL_ACCT_ID = Convert.ToString(item.EXRL_ACCT_ID); if (strEXRL_ACCT_ID == selectedValue) { items.Add(new SelectListItem { Text = item.RCPT_USR_BUS_NM, Value = strEXRL_ACCT_ID, Selected = true }); } else { items.Add(new SelectListItem { Text = item.RCPT_USR_BUS_NM, Value = strEXRL_ACCT_ID, Selected = false }); } } } return(items); }
public static void RenderPlayer(CommonLibrary.Vector2 position, Texture2D tex) { float x = position.x; float y = position.y; GL.BindTexture(TextureTarget.Texture2D, tex.ID); double off = 0.2; GL.Begin(PrimitiveType.Quads); GL.TexCoord2(0, 0); GL.Vertex2(x, y); GL.TexCoord2(1, 0); GL.Vertex2(x + off, y); GL.TexCoord2(1, 1); GL.Vertex2(x + off, y - off); GL.TexCoord2(0, 1); GL.Vertex2(x, y - off); GL.End(); }
public static Resources GetResoureces(CommonLibrary.Utility.MutiLanguage.Languages lang, string filePath, string cacheKey) { return GetResoureces(CommonLibrary.Utility.MutiLanguage.EnumToString(lang), filePath, cacheKey); }
public Account createNewBusinessUserAccount(int bn, string busAgcyNbr, string userNBR, string ctryCD, string langCD) { try { var newAcct = new Account(); var ctryCrcy = new CountryCurrency(); //get Account currency string crcyCD = ctryCrcy.getCurrencyByCountry(ctryCD); if (string.IsNullOrWhiteSpace(crcyCD)) { throw new Exception(); } //generate client account number var busAgcyList = db.TBUS_AGCY.Where(x => x.BN == bn && x.BUS_AGCY_NBR == busAgcyNbr).ToList(); if (busAgcyList.Count() == 0) { return(null); } var busAgcy = busAgcyList[0]; //find agency account var busAcct = db.TACCT.Find(busAgcy.BUS_AGCY_ACCT_ID); if (busAcct == null) { return(null); } int currentLength = db.TBUS_USR.Where(x => x.BN == bn && x.BUS_AGCY_NBR == busAgcyNbr).Count(); if (busAgcyList.Count() == 0) { return(null); } string acctNbr = busAcct.ACCT_NBR + CommonLibrary.generateStringCode(3, currentLength); if (string.IsNullOrWhiteSpace(acctNbr) || acctNbr.Length != 20) { throw new Exception(); } //get Account Culture Info string acctCulInfo = ctryCrcy.getCultureInfoByCountryAndLanguage(ctryCD, langCD); if (string.IsNullOrWhiteSpace(acctCulInfo)) { throw new Exception(); } newAcct.ACCT_TCD = "2"; newAcct.CRCY_CD = crcyCD; newAcct.ACCT_SCD = "01"; newAcct.ACCT_NBR = acctNbr; newAcct.ACCT_NAME = "Compte Courant Affaire"; newAcct.ACCT_BAL = 0.0m; newAcct.ACCT_CLTR_INFO = acctCulInfo; newAcct.LGC_DEL_IND = "0"; newAcct.USR_NBR = userNBR; newAcct.ACCT_CDT = DateTime.Now; return(newAcct); } catch { return(null); } }
public NodeCollection(XmlNode objXmlNode, CommonLibrary.UI.WebControls.Tree objTreeControl) : base(objXmlNode, objTreeControl) { }
protected void ShowNotification(string content,CommonLibrary.NotificationType nt) { ShowNotification(string.Empty, content,nt); }
public abstract void Bind(CommonLibrary.UI.WebControls.Common.NodeCollection objNodes);
//In order to maintain backwards compatibility with the tree from versions before 3.2 we need to allow the //baseclass to return the treenodeenumerator, thus the need to pass the tree to the new base collection class //Yes, this is a hack! protected XmlCollectionBase(CommonLibrary.UI.WebControls.Tree objTreeControl) { m_objTree = objTreeControl; }
public TransactionFeeViewModel getTransactionFee(int FROM_SRVC_ID, int TO_SRVC_ID, string FROM_CTRY_CD, string TO_CTRY_CD, string FROM_CRCY_CD, string TO_CRCY_CD, decimal TRANS_AMT, decimal crcyXchgPercent, string SEND_RCPT_CD, string SRVC_TCD, string CLT_ON_CLT_BHLF_TCD) { try { var model = new TransactionFeeViewModel(); var crcyXchgRt = new CurrencyExchangeRate(); decimal adjustXchgRate = 0.0m; decimal fromXchgRt = 1.0m; string formatString = CommonLibrary.getExchangeRateDecimalPartByCurrencyCD(FROM_CRCY_CD); if (FROM_CTRY_CD != TO_CTRY_CD) // DIFFRENT COUNTRIES { decimal FROM_TRANS_AMT = 0.0M; decimal TO_TRANS_AMT = 0.0M; if (FROM_CRCY_CD != TO_CRCY_CD) // DIFFRENT CURRENCIES { //GET the crcy exchange rate decimal xchgRate = crcyXchgRt.getExchangeRateByCurrency(FROM_CRCY_CD, TO_CRCY_CD); if (xchgRate == 0.0m) { model.ERROR_TXT = CommonLibrary.displayGenericErrorMessage(); return(model); } //GET THE ADJUSTMENT CURRENCY PERCENT RATE if (crcyXchgPercent == 0.0m) { FROM_TRANS_AMT = TRANS_AMT; if (SEND_RCPT_CD == "2") { FROM_TRANS_AMT = TRANS_AMT / xchgRate; } //this first query is to get the approximative sent amount, to get the adjustment var transFeeObj = getTransactionFee(FROM_TRANS_AMT, FROM_SRVC_ID, TO_SRVC_ID, FROM_CTRY_CD, TO_CTRY_CD, FROM_CRCY_CD, TO_CRCY_CD); if (transFeeObj != null) { var crcyXchgPercentObj = new CurrencyExchangePercent(); var getCcrcyXchgPercentObj = crcyXchgPercentObj.getCurrencyExchangePercentByID(transFeeObj.CRCY_XCHG_PRCNT_ID); if (crcyXchgPercentObj != null) { crcyXchgPercent = getCcrcyXchgPercentObj.IVSTR_CRCY_XCHG_PRCNT_RT; } else { crcyXchgPercent = 0.980m; } } } //adjust the currency exchange rate adjustXchgRate = xchgRate; if (xchgRate == 1.0m) { adjustXchgRate = xchgRate; } else if (crcyXchgPercent != 0.0m) { adjustXchgRate = xchgRate * crcyXchgPercent; } if (SEND_RCPT_CD == "1") { FROM_TRANS_AMT = TRANS_AMT; TO_TRANS_AMT = TRANS_AMT * adjustXchgRate; } if (SEND_RCPT_CD == "2") { FROM_TRANS_AMT = TRANS_AMT / adjustXchgRate; TO_TRANS_AMT = TRANS_AMT; } } else { adjustXchgRate = 1.0m; FROM_TRANS_AMT = TRANS_AMT; TO_TRANS_AMT = TRANS_AMT; } model.FROM_TRANS_AMT = FROM_TRANS_AMT; model.TO_TRANS_AMT = TO_TRANS_AMT; // calculate transaction fee var transFeeObj1 = getTransactionFee(model.FROM_TRANS_AMT, FROM_SRVC_ID, TO_SRVC_ID, FROM_CTRY_CD, TO_CTRY_CD, FROM_CRCY_CD, TO_CRCY_CD); if (transFeeObj1 == null) { model.ERROR_TXT = "Il se peut que le type de transaction que vous effectuez n'est pas encore autorisé par PayKap. Contactez nous si vous croyez être une erreur."; return(model); } if (transFeeObj1.TRANS_FEE_TCD == "1") { model.FEE_AMT = transFeeObj1.IVSTR_FIX_FEE_AMT; } else { model.FEE_AMT = transFeeObj1.IVSTR_PRCNT_FEE_RT * model.FROM_TRANS_AMT; } model.CRCY_XCHG_RT_IND = true; model.CRCY_XCHG_RT_TXT = fromXchgRt.ToString("N2") + " " + FROM_CRCY_CD + " = " + adjustXchgRate.ToString(formatString) + " " + TO_CRCY_CD; model.CRCY_XCHG_RT = adjustXchgRate; model.ADJUST_XCHG_RT = crcyXchgPercent; } else // SAME COUNTRIES { if (FROM_CRCY_CD != TO_CRCY_CD) // DIFFRENT CURRENCIES { model.ERROR_TXT = "Les devises des transactions intra nationales ne peuvent pas être differentes"; return(model); } //when the fromCtry and toCtry are the same contries, //the fee comes from the BusinessFee class, the class name will be updating in the future var newBusFee = new BusinessFee(); decimal getBusFee; if (FROM_CTRY_CD == TO_CTRY_CD) { //if it is the same country but the transaction on behalf of the client, apply fee if (CLT_ON_CLT_BHLF_TCD == "1") { getBusFee = 0.0m; } else { //getBusFee IS 0.0 because PayKap does not apply the transFee when it is the same country online. //getBusFee = newBusFee.getClientFeeAmount(TRANS_AMT, FROM_CTRY_CD, FROM_CRCY_CD, SRVC_TCD); //if (getBusFee == 0.0m) //{ // model.ERROR_TXT = "Il se peut que le type de transaction que vous effectuez n'est pas encore autorisé par PayKap. Contactez nous si vous croyez être une erreur."; // return model; //} //decimal getBehalfFeeAmt = getBusFee * 1.3m; //getBusFee = CommonLibrary.roundAmountToCeiling(getBehalfFeeAmt); getBusFee = 0.0m; } } else { getBusFee = newBusFee.getClientFeeAmount(TRANS_AMT, FROM_CTRY_CD, FROM_CRCY_CD, SRVC_TCD); if (getBusFee == 0.0m) { model.ERROR_TXT = "Il se peut que le type de transaction que vous effectuez n'est pas encore autorisé par PayKap. Contactez nous si vous croyez être une erreur."; return(model); } } model.FEE_AMT = getBusFee; model.CRCY_XCHG_RT_IND = false; model.CRCY_XCHG_RT_TXT = ""; model.CRCY_XCHG_RT = 0.0M; model.ADJUST_XCHG_RT = crcyXchgPercent; model.FROM_TRANS_AMT = TRANS_AMT; model.TO_TRANS_AMT = TRANS_AMT; } if (CLT_ON_CLT_BHLF_TCD == "1") { model.TOT_TO_PAY_AMT = model.FROM_TRANS_AMT + model.FEE_AMT; } else { decimal getBehalfFeeAmt = model.FEE_AMT * 1.3m; model.FEE_AMT = CommonLibrary.roundAmountToCeiling(getBehalfFeeAmt); model.TOT_TO_PAY_AMT = model.FROM_TRANS_AMT + model.FEE_AMT; } var newObjCultureInfo = new CountryCurrency(); string cultureInfo = newObjCultureInfo.getCultureInfoByCurrencyCD(FROM_CRCY_CD, "FRA"); string cultureInfo1 = newObjCultureInfo.getCultureInfoByCurrencyCD(TO_CRCY_CD, "FRA"); model.FROM_TRANS_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.FROM_TRANS_AMT, FROM_CRCY_CD, cultureInfo); model.FEE_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.FEE_AMT, FROM_CRCY_CD, cultureInfo); model.TOT_TO_PAY_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.TOT_TO_PAY_AMT, FROM_CRCY_CD, cultureInfo); model.TO_TRANS_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.TO_TRANS_AMT, TO_CRCY_CD, cultureInfo1); model.SEND_RCPT_CD = SEND_RCPT_CD; model.FROM_CTRY_CD = FROM_CTRY_CD; model.TO_CTRY_CD = TO_CTRY_CD; model.FROM_CRCY_CD = FROM_CRCY_CD; model.TO_CRCY_CD = TO_CRCY_CD; model.FROM_SRVC_ID = FROM_SRVC_ID; model.TO_SRVC_ID = TO_SRVC_ID; //handle the promo code if (model.FROM_CTRY_CD == "124") // Canada { model.FEE_AMT_PROMO_CD = 0.0m; } if (model.FROM_CTRY_CD == "120" && model.TO_CTRY_CD == "120") // Cameroun { model.FEE_AMT_PROMO_CD = model.FEE_AMT - 1000; if (model.FEE_AMT_PROMO_CD < 0.0m) { model.FEE_AMT_PROMO_CD = 0.0m; } } model.TOT_TO_PAY_AMT_PROMO_CD = model.FROM_TRANS_AMT + model.FEE_AMT_PROMO_CD; model.FEE_AMT_TXT_PROMO_CD = CommonLibrary.displayFormattedCurrency(model.FEE_AMT_PROMO_CD, FROM_CRCY_CD, cultureInfo); model.TOT_TO_PAY_AMT_TXT_PROMO_CD = CommonLibrary.displayFormattedCurrency(model.TOT_TO_PAY_AMT_PROMO_CD, FROM_CRCY_CD, cultureInfo); model.ERROR_TXT = "ok"; return(model); } catch { return(null); } }
//public TransactionFeeViewModel getTransactionFee(int FROM_SRVC_ID, int TO_SRVC_ID, // string FROM_CTRY_CD, string TO_CTRY_CD, // string FROM_CRCY_CD, string TO_CRCY_CD, // decimal TRANS_AMT, decimal crcyXchgPercent, // string SEND_RCPT_CD, string SRVC_TCD) //{ // try // { // var model = new TransactionFeeViewModel(); // var crcyXchgRt = new CurrencyExchangeRate(); // decimal adjustXchgRate = 0.0m; // decimal fromXchgRt = 1.0m; // string formatString = CommonLibrary.getExchangeRateDecimalPartByCurrencyCD(FROM_CRCY_CD); // if (FROM_CTRY_CD != TO_CTRY_CD) // DIFFRENT COUNTRIES // { // decimal FROM_TRANS_AMT = 0.0M; // decimal TO_TRANS_AMT = 0.0M; // if (FROM_CRCY_CD != TO_CRCY_CD) // DIFFRENT CURRENCIES // { // //GET the crcy exchange rate // decimal xchgRate = crcyXchgRt.getExchangeRateByCurrency(FROM_CRCY_CD, TO_CRCY_CD); // if (xchgRate == 0.0m) // { // model.ERROR_TXT = CommonLibrary.displayGenericErrorMessage(); // return model; // } // //GET THE ADJUSTMENT CURRENCY PERCENT RATE // if (crcyXchgPercent == 0.0m) // { // FROM_TRANS_AMT = TRANS_AMT; // if (SEND_RCPT_CD == "2") // { // FROM_TRANS_AMT = TRANS_AMT / xchgRate; // } // //this first query is to get the approximative sent amount, to get the adjustment // var transFeeObj = getTransactionFee(FROM_TRANS_AMT, FROM_SRVC_ID, TO_SRVC_ID, // FROM_CTRY_CD, TO_CTRY_CD, FROM_CRCY_CD, TO_CRCY_CD); // if (transFeeObj != null) // { // var crcyXchgPercentObj = new CurrencyExchangePercent(); // var getCcrcyXchgPercentObj = crcyXchgPercentObj.getCurrencyExchangePercentByID(transFeeObj.CRCY_XCHG_PRCNT_ID); // if (crcyXchgPercentObj != null) // { // crcyXchgPercent = getCcrcyXchgPercentObj.IVSTR_CRCY_XCHG_PRCNT_RT; // } // else // { // crcyXchgPercent = 0.980m; // } // } // } // //adjust the currency exchange rate // adjustXchgRate = xchgRate; // if (xchgRate == 1.0m) // { // adjustXchgRate = xchgRate; // } // else if (crcyXchgPercent != 0.0m) // { // adjustXchgRate = xchgRate * crcyXchgPercent; // } // if (SEND_RCPT_CD == "1") // { // FROM_TRANS_AMT = TRANS_AMT; // TO_TRANS_AMT = TRANS_AMT * adjustXchgRate; // } // if (SEND_RCPT_CD == "2") // { // FROM_TRANS_AMT = TRANS_AMT / adjustXchgRate; // TO_TRANS_AMT = TRANS_AMT; // } // } // else // { // adjustXchgRate = 1.0m; // FROM_TRANS_AMT = TRANS_AMT; // TO_TRANS_AMT = TRANS_AMT; // } // model.FROM_TRANS_AMT = FROM_TRANS_AMT; // model.TO_TRANS_AMT = TO_TRANS_AMT; // // calculate transaction fee // var transFeeObj1 = getTransactionFee(model.FROM_TRANS_AMT, FROM_SRVC_ID, TO_SRVC_ID, // FROM_CTRY_CD, TO_CTRY_CD, FROM_CRCY_CD, TO_CRCY_CD); // if (transFeeObj1 == null) // { // model.ERROR_TXT = "Il se peut que le type de transaction que vous effectuez n'est pas encore autorisé par PayKap. Contactez nous si vous croyez être une erreur."; // return model; // } // if(transFeeObj1.TRANS_FEE_TCD == "1") // { // model.FEE_AMT = transFeeObj1.IVSTR_FIX_FEE_AMT; // } // else // { // model.FEE_AMT = transFeeObj1.IVSTR_PRCNT_FEE_RT * model.FROM_TRANS_AMT; // } // model.CRCY_XCHG_RT_IND = true; // model.CRCY_XCHG_RT_TXT = fromXchgRt.ToString("N2") + " " + FROM_CRCY_CD + " = " + adjustXchgRate.ToString(formatString) + " " + TO_CRCY_CD; // model.CRCY_XCHG_RT = adjustXchgRate; // model.ADJUST_XCHG_RT = crcyXchgPercent; // } // else // SAME COUNTRIES // { // if(FROM_CRCY_CD != TO_CRCY_CD) // DIFFRENT CURRENCIES // { // model.ERROR_TXT = "Les devises des transactions intra nationales ne peuvent pas être differentes"; // return model; // } // //when the fromCtry and toCtry are the same contries, // //the fee comes from the BusinessFee class, the class name will be updating in the future // var newBusFee = new BusinessFee(); // decimal getBusFee; // if (FROM_CTRY_CD == TO_CTRY_CD) // { // getBusFee = 0.0m; // } // else // { // getBusFee = newBusFee.getClientFeeAmount(TRANS_AMT, FROM_CTRY_CD, FROM_CRCY_CD, SRVC_TCD); // if (getBusFee == 0.0m) // { // model.ERROR_TXT = "Il se peut que le type de transaction que vous effectuez n'est pas encore autorisé par PayKap. Contactez nous si vous croyez être une erreur."; // return model; // } // } // model.FEE_AMT = getBusFee; // model.CRCY_XCHG_RT_IND = false; // model.CRCY_XCHG_RT_TXT = ""; // model.CRCY_XCHG_RT = 0.0M; // model.ADJUST_XCHG_RT = crcyXchgPercent; // model.FROM_TRANS_AMT = TRANS_AMT; // model.TO_TRANS_AMT = TRANS_AMT; // } // model.TOT_TO_PAY_AMT = model.FROM_TRANS_AMT + model.FEE_AMT; // var newObjCultureInfo = new CountryCurrency(); // string cultureInfo = newObjCultureInfo.getCultureInfoByCurrencyCD(FROM_CRCY_CD, "FRA"); // string cultureInfo1 = newObjCultureInfo.getCultureInfoByCurrencyCD(TO_CRCY_CD, "FRA"); // model.FROM_TRANS_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.FROM_TRANS_AMT, FROM_CRCY_CD, cultureInfo); // model.FEE_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.FEE_AMT, FROM_CRCY_CD, cultureInfo); // model.TOT_TO_PAY_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.TOT_TO_PAY_AMT, FROM_CRCY_CD, cultureInfo); // model.TO_TRANS_AMT_TXT = CommonLibrary.displayFormattedCurrency(model.TO_TRANS_AMT, TO_CRCY_CD, cultureInfo1); // model.SEND_RCPT_CD = SEND_RCPT_CD; // model.FROM_CTRY_CD = FROM_CTRY_CD; // model.TO_CTRY_CD = TO_CTRY_CD; // model.FROM_CRCY_CD = FROM_CRCY_CD; // model.TO_CRCY_CD = TO_CRCY_CD; // model.FROM_SRVC_ID = FROM_SRVC_ID; // model.TO_SRVC_ID = TO_SRVC_ID; // //handle the promo code // if (model.FROM_CTRY_CD == "124") // Canada // { // model.FEE_AMT_PROMO_CD = 0.0m; // } // if (model.FROM_CTRY_CD == "120" && model.TO_CTRY_CD == "120") // Cameroun // { // model.FEE_AMT_PROMO_CD = model.FEE_AMT - 1000; // if (model.FEE_AMT_PROMO_CD < 0.0m) // { // model.FEE_AMT_PROMO_CD = 0.0m; // } // } // model.TOT_TO_PAY_AMT_PROMO_CD = model.FROM_TRANS_AMT + model.FEE_AMT_PROMO_CD; // model.FEE_AMT_TXT_PROMO_CD = CommonLibrary.displayFormattedCurrency(model.FEE_AMT_PROMO_CD, FROM_CRCY_CD, cultureInfo); // model.TOT_TO_PAY_AMT_TXT_PROMO_CD = CommonLibrary.displayFormattedCurrency(model.TOT_TO_PAY_AMT_PROMO_CD, FROM_CRCY_CD, cultureInfo); // model.ERROR_TXT = "ok"; // return model; // } // catch // { // return null; // } //} public TransactionFeeViewModel convertAmount(int FROM_SRVC_ID, int TO_SRVC_ID, string FROM_CTRY_CD, string TO_CTRY_CD, string FROM_CRCY_CD, string TO_CRCY_CD, decimal TRANS_AMT, decimal crcyXchgPercent, string SEND_RCPT_CD) { try { var model = new TransactionFeeViewModel(); var crcyXchgRt = new CurrencyExchangeRate(); //GET the crcy exchange rate decimal xchgRate = crcyXchgRt.getExchangeRateByCurrency(FROM_CRCY_CD, TO_CRCY_CD); if (xchgRate == 0.0m) { return(null); } //GET THE ADJUSTMENT CURRENCY PERCENT RATE if (crcyXchgPercent == 0.0m) { decimal CONVERT_TRANS_AMT = 0.0m;; if (SEND_RCPT_CD == "1") { CONVERT_TRANS_AMT = xchgRate * TRANS_AMT; } else if (SEND_RCPT_CD == "2") { CONVERT_TRANS_AMT = TRANS_AMT / xchgRate; } var transFeeObj = getTransactionFee(CONVERT_TRANS_AMT, FROM_SRVC_ID, TO_SRVC_ID, FROM_CTRY_CD, TO_CTRY_CD, FROM_CRCY_CD, TO_CRCY_CD); if (transFeeObj != null) { var crcyXchgPercentObj = new CurrencyExchangePercent(); var getCcrcyXchgPercentObj = crcyXchgPercentObj.getCurrencyExchangePercentByID(crcyXchgPercentObj.CRCY_XCHG_PRCNT_ID); if (crcyXchgPercentObj != null) { crcyXchgPercent = getCcrcyXchgPercentObj.IVSTR_CRCY_XCHG_PRCNT_RT; } } } //adjust the currency exchange rate decimal adjustXchgRate = xchgRate; if (xchgRate == 1.0m) { adjustXchgRate = xchgRate; } else if (crcyXchgPercent != 0.0m) { adjustXchgRate = xchgRate * crcyXchgPercent; } decimal fromXchgRt = 1.0m; string formatString = CommonLibrary.getExchangeRateDecimalPartByCurrencyCD(FROM_CRCY_CD); if (SEND_RCPT_CD == "1") { model.TO_TRANS_AMT = adjustXchgRate * TRANS_AMT; } else if (SEND_RCPT_CD == "2") { model.FROM_TRANS_AMT = TRANS_AMT / adjustXchgRate; } model.CRCY_XCHG_RT_TXT = fromXchgRt.ToString("N2") + " " + FROM_CRCY_CD + " = " + adjustXchgRate.ToString(formatString) + " " + TO_CRCY_CD; model.CRCY_XCHG_RT = adjustXchgRate; model.CRCY_XCHG_RT_IND = true; model.ADJUST_XCHG_RT = crcyXchgPercent; return(model); } catch { return(null); } }
protected void RaiseEvent_NodeClick(CommonLibrary.UI.WebControls.Common.Node objNode) { if (NodeClick != null) { NodeClick(new NavigationEventArgs(objNode.ID, objNode)); } }
public XmlCollectionBase(XmlNode objXmlNode, CommonLibrary.UI.WebControls.Tree objTreeControl) { m_objTree = objTreeControl; InnerXMLNode = objXmlNode; InnerXMLDoc = InnerXMLNode.OwnerDocument; }
/// <summary> /// ��Ƶ���������ı� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void PB_Bright_ProgressEvent(object sender, CommonLibrary.NetControls.ProgressEventArg e) { Viedo(); }
void model_GraphGenerated(object sender, CommonLibrary.Model.Events.GraphGeneratedArgs e) { GraphTables.Add(e.GeneratedArgs); if (GraphTables.Count == iterations) { OnGraphsGenerated(); } }
//In order to maintain backwards compatibility with the tree from versions before 3.2 we need to allow the //baseclass to return the treenodeenumerator, thus the need to pass the tree to the new base collection class //Yes, this is a hack! public NodeCollection(string strNamespace, CommonLibrary.UI.WebControls.Tree objTreeControl) : base(strNamespace, objTreeControl) { }
public string GetResStr(string name) { return(CommonLibrary.GetResourceString(name)); }
public static Stream GetFileStream(CommonLibrary.Services.FileSystem.FileInfo objFile) { CommonLibrary.Services.FileSystem.FileController objFileController = new CommonLibrary.Services.FileSystem.FileController(); Stream fileStream = null; switch (objFile.StorageLocation) { case (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.InsecureFileSystem: fileStream = new FileStream(objFile.PhysicalPath, FileMode.Open, FileAccess.Read, FileShare.Read); break; case (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.SecureFileSystem: fileStream = new FileStream(objFile.PhysicalPath + Globals.glbProtectedExtension, FileMode.Open, FileAccess.Read, FileShare.Read); break; case (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.DatabaseSecure: fileStream = new MemoryStream(objFileController.GetFileContent(objFile.FileId, objFile.PortalId)); break; } return fileStream; }
protected void ShowNotification(string title, string content, CommonLibrary.NotificationType nt, string redirectUrl) { CommonLibrary.Notification.Show(this, title, content,nt, redirectUrl,true,5); }
private static void RemoveOrphanedFiles(CommonLibrary.Services.FileSystem.FolderInfo folder, int PortalId) { CommonLibrary.Services.FileSystem.FileController objFileController = new CommonLibrary.Services.FileSystem.FileController(); if (folder.StorageLocation != (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.DatabaseSecure) { foreach (CommonLibrary.Services.FileSystem.FileInfo objFile in GetFilesByFolder(PortalId, folder.FolderID)) { RemoveOrphanedFile(objFile, PortalId); } } }
public virtual bool IsTabPublic(CommonLibrary.Security.Permissions.TabPermissionCollection objTabPermissions) { string roles = objTabPermissions.ToString("VIEW"); bool hasPublicRole = false; if ((roles != null)) { // permissions strings are encoded with Deny permissions at the beginning and Grant permissions at the end for optimal performance foreach (string role in roles.Split(new char[] { ';' })) { if (!string.IsNullOrEmpty(role)) { // Deny permission if (role.StartsWith("!")) { string denyRole = role.Replace("!", ""); if ((denyRole == Globals.glbRoleUnauthUserName || denyRole == Globals.glbRoleAllUsersName)) { hasPublicRole = false; break; // TODO: might not be correct. Was : Exit For } // Grant permission } else { if ((role == Globals.glbRoleUnauthUserName || role == Globals.glbRoleAllUsersName)) { hasPublicRole = true; break; // TODO: might not be correct. Was : Exit For } } } } } return hasPublicRole; }
private static void RemoveOrphanedFile(CommonLibrary.Services.FileSystem.FileInfo objFile, int PortalId) { CommonLibrary.Services.FileSystem.FileController objFileController = new CommonLibrary.Services.FileSystem.FileController(); string strFile = ""; switch (objFile.StorageLocation) { case (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.InsecureFileSystem: strFile = objFile.PhysicalPath; break; case (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.SecureFileSystem: strFile = objFile.PhysicalPath + Globals.glbProtectedExtension; break; } if (!String.IsNullOrEmpty(strFile)) { if (!File.Exists(strFile)) { objFileController.DeleteFile(PortalId, objFile.FileName, objFile.FolderId, true); } } }
public List <SelectListItem> getBusinessOnlineBankAccountList(string usrNbr, string usrTCD, string selectedValue) { List <SelectListItem> items = new List <SelectListItem>(); var acctList = db.TACCT.Where(x => x.USR_NBR == usrNbr && x.ACCT_TCD == "2" && x.ACCT_SCD == "01").ToList(); if (acctList.Count() == 0) { return(items); } var acct = acctList[0]; int bn = Convert.ToInt32(acct.ACCT_NBR.Substring(0, 9)); var myList = from bankAcct in db.TFI_EXRL_ACCT join rcptBus in db.TRCPT_EXRL_ACCT_FOR_BUS on bankAcct.EXRL_ACCT_ID equals rcptBus.EXRL_ACCT_ID where (rcptBus.BN == bn && rcptBus.RCPT_EXRL_ACCT_FOR_BUS_TCD == "1" && bankAcct.EXRL_ACCT_FOR_CURT_USR_IND == "0" && bankAcct.USR_NBR == usrNbr) select bankAcct; if (acctList.Count() != 0) { items.Add(new SelectListItem { Text = "-------Compte PayKap Affaire-----------------", Value = "" }); foreach (var item in acctList) { string bal = CommonLibrary.displayFormattedCurrency(item.ACCT_BAL, item.ACCT_CLTR_INFO); item.ACCT_NBR = formatAccountNumber(item.ACCT_NBR, usrTCD) + " - " + item.CRCY_CD.ToUpper() + " = " + bal; string strACCT_ID = "PKP" + Convert.ToString(item.ACCT_ID); if (strACCT_ID == selectedValue) { items.Add(new SelectListItem { Text = item.ACCT_NBR, Value = strACCT_ID, Selected = true }); } else { items.Add(new SelectListItem { Text = item.ACCT_NBR, Value = strACCT_ID, Selected = false }); } } //var list = new SelectList(acctList, "ACCT_ID", "ACCT_NBR", selectedValue).ToList(); } if (myList.Count() != 0) { items.Add(new SelectListItem { Text = "", Value = "" }); items.Add(new SelectListItem { Text = "-------Comptes bancaires Affaire-------------", Value = "" }); foreach (var item in myList) { item.RCPT_USR_BUS_NM = item.EXRL_ACCT_NBR + " - " + item.CRCY_CD; string strEXRL_ACCT_ID = Convert.ToString(item.EXRL_ACCT_ID); if (strEXRL_ACCT_ID == selectedValue) { items.Add(new SelectListItem { Text = item.RCPT_USR_BUS_NM, Value = strEXRL_ACCT_ID, Selected = true }); } else { items.Add(new SelectListItem { Text = item.RCPT_USR_BUS_NM, Value = strEXRL_ACCT_ID, Selected = false }); } } } return(items); }
public static string AddFile(string strFile, int PortalId, bool ClearCache, CommonLibrary.Services.FileSystem.FolderInfo folder) { string retValue = ""; try { CommonLibrary.Services.FileSystem.FileController objFileController = new CommonLibrary.Services.FileSystem.FileController(); System.IO.FileInfo fInfo = new System.IO.FileInfo(strFile); string sourceFolderName = Globals.GetSubFolderPath(strFile, PortalId); string sourceFileName; if (folder.StorageLocation == (int)CommonLibrary.Services.FileSystem.FolderController.StorageLocationTypes.SecureFileSystem) { sourceFileName = GetFileName(strFile); } else { sourceFileName = strFile; } CommonLibrary.Services.FileSystem.FileInfo file = objFileController.GetFile(sourceFileName, PortalId, folder.FolderID); if (file == null) { FileStream fileStrm = null; try { fileStrm = fInfo.OpenRead(); AddFile(PortalId, fileStrm, strFile, "", fInfo.Length, sourceFolderName, true, ClearCache, true); } finally { if (fileStrm != null) { fileStrm.Close(); fileStrm.Dispose(); } } } else { if (file.Size != fInfo.Length) { string extension = Path.GetExtension(strFile).Replace(".", ""); UpdateFileData(file.FileId, folder.FolderID, PortalId, sourceFileName, extension, GetContentType(extension), fInfo.Length, sourceFolderName); } } } catch (Exception ex) { retValue = ex.Message; } return retValue; }
public void Initialise(string configLocation, string clientId) { if (string.IsNullOrEmpty(configLocation)) { configLocation = DEFAULT_CONFIG_LOCATION; } FileLibrary fileControl = new FileLibrary(); CommonLibrary lib = new CommonLibrary(); _configLocation = configLocation; string xml = fileControl.ReadXmlFile(_configLocation); SchemaLibrary validateSchema = new SchemaLibrary(); if (!validateSchema.Validate(xml, DEFAULT_SCHEMA_LOCATION)) { throw new TrappedException(enmMessageCode.SchemaFailedValidation); } ConfigXml = new XmlDocument(); ConfigXml.LoadXml(xml); ClientId = clientId; //IPAddress = lib.GetString(ConfigXml, "Config/SettingList/Setting[@id='ipaddress']", "value", regexMatch: Properties.Resources.RegexIPAddress); //Port = lib.GetInt(ConfigXml, "Config/SettingList/Setting[@id='port']", "value"); //Prompt = lib.GetString(ConfigXml, "Config/SettingList/Setting[@id='prompt']", "value"); //Language = lib.GetString(ConfigXml, "Config/SettingList/Setting[@id='language']", "value"); //IsEncrypted = lib.GetBoolean(ConfigXml, "Config/SettingList/Setting[@id='isencrypted']", "value"); //AllowGuests = lib.GetBoolean(ConfigXml, "Config/SettingList/Setting[@id='allowguests']", "value"); }
public NavigationEventArgs(string strID, CommonLibrary.UI.WebControls.Common.Node objNode) { this.ID = strID; this.Node = objNode; }
/* /// <summary> /// ���������¼� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SVolume_VolumeSetEvent(object sender, CommonLibrary.WinControls.VolumeSetEventArg e) { m_Volume = e.Value; Audio(); } private void Sound_progressBar_ProgressEvent(object sender, CommonLibrary.NetControls.ProgressEventArg e) { m_Volume = e.Value; Audio(); } */ /// <summary> /// ���������¼� /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void userControlSound1_VolumeSetEvent(object sender, CommonLibrary.WinControls.SoundVolumeEventArg e) { m_Volume = e.Value; Audio(); }
public static byte[] GetFileContent(CommonLibrary.Services.FileSystem.FileInfo objFile) { Stream objStream = null; byte[] objContent = null; try { objStream = FileSystemUtils.GetFileStream(objFile); BinaryReader objBinaryReader = new BinaryReader(objStream); objContent = objBinaryReader.ReadBytes(Convert.ToInt32(objStream.Length)); objBinaryReader.Close(); } finally { if (objStream != null) { objStream.Close(); objStream.Dispose(); } } return objContent; }
public void ReassignDepartment() { System.Diagnostics.Debugger.Launch(); string TestDataSheetPath = "D:\\selenium\\CrosswalkUIAutomation\\CrosswalkUIAutomation\\TestData\\TestData.xlsx", TestDataSheetName = "TestData", TestScriptId1 = "TS_01", TestScriptId2 = "TS_02"; int TestDataRow1 = FrameworkLibrary.PopulateInCollection(TestDataSheetPath, TestDataSheetName, TestScriptId1), TestDataRow2 = FrameworkLibrary.PopulateInCollection(TestDataSheetPath, TestDataSheetName, TestScriptId2); driver = new ChromeDriver(@"D:\selenium\CrosswalkUIAutomation\CrosswalkUIAutomation"); LoginAction.Login(driver, "https://cftest.hsc.usf.edu/dwdeptassignment/index.cfm", "sivaravula", "Bahubali2"); // reassign Fast departments from "ANCILLARY SUPPORT" to "AREA HEALTH EDUCATION CENTER" CommonLibrary.SetOperationsOnControls(driver, "click", "XPath", "//*[@id='openCloseIcon_1']", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow1, "AssignDepartment")); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow1, "AssignDepartment")); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow1, "AssignDepartment")); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "XPath", "//*[@id='openCloseIcon_1']", ""); System.Threading.Thread.Sleep(2000); // reassign Fast departments from "AREA HEALTH EDUCATION CENTER" to "ANCILLARY SUPPORT" CommonLibrary.SetOperationsOnControls(driver, "click", "XPath", "//*[@id='openCloseIcon_2']", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow2, "AssignDepartment")); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow2, "AssignDepartment")); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); System.Threading.Thread.Sleep(2000); CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow2, "AssignDepartment")); System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); System.Threading.Thread.Sleep(2000); //CommonLibrary.SelectRecordInTableByRowNo(driver, "//*[@id='fast_table']", 1, 1); //System.Threading.Thread.Sleep(2000); //CommonLibrary.SetOperationsOnControls(driver, "select", "Id", "deptAssignSel", FrameworkLibrary.ReadData(TestDataRow2, "AssignDepartment")); //System.Threading.Thread.Sleep(2000); //CommonLibrary.SetOperationsOnControls(driver, "click", "Id", "reassignBut", ""); //System.Threading.Thread.Sleep(2000); CommonLibrary.SetOperationsOnControls(driver, "click", "XPath", "//*[@id='openCloseIcon_2']", ""); System.Threading.Thread.Sleep(2000); }
public ActionResult Register(CommonLibrary.Member.RegisterViewModel registerViewModel) { if (ModelState.IsValid) { var register = new ShoppingWebAPI.Controllers.RegisterController(); CommonLibrary.DataResult dataResult = register.Post(registerViewModel); if (dataResult.Status == 1) { //登入時清空所有 Session 資料 Session.RemoveAll(); FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1, registerViewModel.Email,//你想要存放在 User.Identy.Name 的值,通常是使用者帳號 DateTime.Now, DateTime.Now.AddMinutes(30), false,//將管理者登入的 Cookie 設定成 Session Cookie registerViewModel.Nickname,//userdata看你想存放啥 FormsAuthentication.FormsCookiePath); string encTicket = FormsAuthentication.Encrypt(ticket); Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket)); return RedirectToRoute(new { controller = "Home", action = "Index" }); } else { TempData["AlertMessage"] = dataResult.ErrorMessage; return View(); } //todo:登入方式改這個 #region callapi test/ //var register = new ShoppingWebAPI2.Controllers.AccountController(); //ShoppingWebAPI2.Models.RegisterBindingModel registerBindingModel = new ShoppingWebAPI2.Models.RegisterBindingModel(); //registerBindingModel.Email = registerViewModel.Email; //registerBindingModel.Password = registerViewModel.Password; //registerBindingModel.ConfirmPassword = registerViewModel.ConfirmPassword; //string json_data = JsonConvert.SerializeObject(registerBindingModel); //using (HttpClient client = new HttpClient()) //{ // string url = "http://*****:*****@yahoo.com.tw 已使用。\",\"電子郵件 '*****@*****.**' 已使用。\"]}}" //} #endregion } return View(); }