private void OnMainFileDownloadSuccess(byte[] pBytes) { string json = Encoding.UTF8.GetString(pBytes); Debug.Log(json); MainJson mainJson = JsonUtility.FromJson <MainJson>(json); Application.targetFrameRate = AppConst.s_FrameRate = mainJson.frameRate; AppConst.s_IsDebug = mainJson.isDebug; AppConst.s_Host = mainJson.host; AppConst.s_AppVersion = AppVersion.Create(mainJson.version); //资源版本取PlayerPrefs存的 if (PlayerPrefs.HasKey("ResVersion")) { AppConst.s_AppVersion.d = PlayerPrefs.GetInt("ResVersion"); } foreach (MainTextJson mainTextJson in mainJson.texts) { GameMain.Instance.m_Texts[mainTextJson.id] = mainTextJson.text; } //下载远程Version配置 string path = AppConst.GetRemoteURL("Version.json"); DownloadManager.Instance.DownloadFileAsync(path, OnVersionFileDownloadSuccess, pProgressCallback: OnVersionFileDowloadProgress); }
/// <summary> /// Gửi tin quảng cáo /// Url: https://qc.vietguys.biz/api/sendsms.php /// </summary> /// <param name="user"></param> /// <param name="password"></param> /// <param name="sender"></param> /// <param name="sms"></param> /// <param name="listPhone"></param> /// <param name="date"></param> /// <param name="time"></param> /// <returns></returns> public async Task <string> SendSMS_QCAsync(string user, string password, string sender, string sms, string listPhone, string date, string time) { try { string url = String.Format("{0}?phone={1}&from={2}&sms={3}&u={4}&pwd={5}&day={6}&time={7}", this.Url, listPhone, sender, sms, user, password, date, time); using (HttpClient http = new HttpClient()) { using (HttpRequestMessage httpRequest = new HttpRequestMessage(HttpMethod.Get, url)) { HttpResponseMessage response = await http.SendAsync(httpRequest); if (response != null) { string result = await response.Content.ReadAsStringAsync(); logger.Info(AppConst.A("SendSMS_QCAsync", url, user, password, sender, sms, listPhone, date, time, result)); return(String.IsNullOrEmpty(result) ? String.Empty : result.Trim()); } } } } catch (Exception ex) { logger.Error(AppConst.A("SendSMS_QCAsync", this.Url, user, password, sender, sms, listPhone, date, time, ex)); } return(String.Empty); }
void TimerIsOver() { if (IsTimer) { IsTimer = false; Debuger.LogError(cutTimer + " GAME OVER!!!"); Util.SaveHeroData(); cutTimer = AppConst.TimerTotal; UIManager.Instance.ShowWindow(WindowID.WindowID_Over); GameMgr.Instance.StopAllCoroutines(); GameMgr.Instance.IsEnterGame = false; if (null != m_UIDead) { m_UIDead.HideDeadUI(); } Timer.Instance.Clear(); TSCData.Instance.Clear(); PoolMgr.Instance.DespawnerAll(); GameMgr.Instance.MainEntity.Clear(); AppConst.Clear(); UIManager.Instance.HideWindow(WindowID.WindowID_FirstUI); UIManager.Instance.HideWindow(WindowID.WindowID_MainUI); } }
protected override void OnFormClosing(FormClosingEventArgs e) { try { base.OnFormClosing(e); if (e.CloseReason == CloseReason.WindowsShutDown) { return; } if (MessageBox.Show(this, "Close PushSMS and kill process ?", "Closing", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (this.oracleDependency != null && this.oracleDependency.IsEnabled) { this.oracleDependency.OnChange -= new OnChangeEventHandler(OracleListenerCallback); this.oracleDependency?.RemoveRegistration(this.connection); this.connection?.Close(); this.connection?.Dispose(); } logger.Info("Stoped application !"); Process.GetCurrentProcess().Kill(); } else { e.Cancel = true; } } catch (Exception ex) { logger.Error(AppConst.A("OnFormClosing", ex)); Process.GetCurrentProcess().Kill(); } }
//加载配置表数据 void InitTemplate() { string path = new System.Text.StringBuilder().Append(AppConst.AppPersistentPath).Append('/').Append(AppConst.TextDir).Append('/').ToString(); Util.Init <HeroInfo>(path); Util.Init <EffectInfo>(path); Util.Init <ParticleInfo>(path); Util.Init <SkillInfo>(path); Util.Init <LanSurInfo>(path); Util.Init <LanTxtInfo>(path); Util.Init <ConstInfo>(path); Util.Init <OccupationInfo>(path); Util.Init <ItemInfo>(path); Util.Init <LevelInfo>(path); Util.Init <ItemEffectInfo>(path); Util.Init <ObstacleInfo>(path); Util.Init <NameInfo>(path); Util.InitMap(path + "map.bin"); Debug.LogError("Load Lanague"); //初始化常量表数据 AppConst.InitConstData(); //BeginGame(); }
public static void BuildFileIndex() { string resPath = Application.dataPath.ToLower() + "/StreamingAssets/"; ///----------------------创建文件列表----------------------- string newFilePath = resPath + "/files.txt"; if (File.Exists(newFilePath)) { File.Delete(newFilePath); } paths.Clear(); files.Clear(); Recursive(resPath); FileStream fs = new FileStream(newFilePath, FileMode.CreateNew); StreamWriter sw = new StreamWriter(fs); for (int i = 0; i < files.Count; i++) { string file = files[i]; if (file.EndsWith(".meta") || file.Contains(".DS_Store")) { continue; } string md5 = AppConst.md5file(file); string value = file.Replace(resPath, string.Empty); sw.WriteLine(value + "|" + md5); } sw.Close(); fs.Close(); }
//加载配置表数据 void InitTemplate() { string path = new System.Text.StringBuilder().Append(AppConst.AppPersistentPath).Append('/').Append(AppConst.TextDir).Append('/').ToString(); Util.Init <HeroInfo>(path); Util.Init <EffectInfo>(path); Util.Init <ParticleInfo>(path); Util.Init <SkillInfo>(path); Util.Init <LanSurInfo>(path); Util.Init <LanTxtInfo>(path); Util.Init <ConstInfo>(path); Util.Init <OccupationInfo>(path); Util.Init <ItemInfo>(path); Util.Init <LevelInfo>(path); Util.Init <ItemEffectInfo>(path); Util.InitMap(path + "map.bin"); //初始化常量表数据 AppConst.InitConstData(); CreateEntity(1); MapId = 2; ItemDropMgr.Instance.InitMapDrop(); UIManager.Instance.ShowWindow(WindowID.WindowID_MainUI); }
public void EeditorLoadLuaFile(string root, string luaPath, ref Dictionary <string, byte[]> dic) { string[] files = Directory.GetFiles(luaPath); foreach (string file in files) { if (!AppConst.LuaExtNames.Contains(Path.GetExtension(file))) { continue; } string fileName = AppConst.ToValidFileName(root, file); if (dic.ContainsKey(fileName)) { Debug.LogError("发现重复的lua文件 名称为" + fileName); } dic[fileName] = File.ReadAllBytes(file); } string[] dirs = Directory.GetDirectories(luaPath); if (dirs == null || dirs.Length <= 0) { return; } foreach (string dir in dirs) { EeditorLoadLuaFile(root, dir, ref dic); } }
void InitTemplate() { string path = new System.Text.StringBuilder().Append(AppConst.AppPersistentPath).Append('/').Append(AppConst.TextDir).Append('/').ToString(); Util.Init <HeroInfo>(path); Util.Init <EffectInfo>(path); Util.Init <ParticleInfo>(path); Util.Init <SkillInfo>(path); Util.Init <LanSurInfo>(path); Util.Init <LanTxtInfo>(path); Util.Init <ConstInfo>(path); Util.Init <OccupationInfo>(path); Util.Init <ItemInfo>(path); Util.Init <LevelInfo>(path); Util.Init <ItemEffectInfo>(path); Util.Init <ObstacleInfo>(path); Util.Init <NameInfo>(path); Util.Init <EquipInfo>(path); Util.Init <FashionInfo>(path); Util.InitMap(path + "map.bin"); TSCData.Instance.ReadHeroData(); Util.GetHeroUseSkin(); AppConst.InitConstData(); Debug.LogError("Start Game"); UIManager.Instance.ShowWindow(WindowID.WindowID_FirstUI); }
protected override void OnFormClosing(FormClosingEventArgs e) { try { base.OnFormClosing(e); if (e.CloseReason == CloseReason.WindowsShutDown) { return; } if (MessageBox.Show(this, "Close Operator Gateway and kill process ?", "Closing", MessageBoxButtons.YesNo) == DialogResult.Yes) { this.IsStop = true; this.cancelToken.Cancel(); logger.Info("Stoped application !"); Process.GetCurrentProcess().Kill(); } else { e.Cancel = true; } } catch (Exception ex) { logger.Error(AppConst.A("OnFormClosing", ex)); Process.GetCurrentProcess().Kill(); } }
public Employee InsertEmployee(Employee employeeObj) { try { SqlParameter outputStatus, outputID = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[InsertEmployee]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Code", SqlDbType.VarChar, 10).Value = employeeObj.Code; cmd.Parameters.Add("@Name", SqlDbType.VarChar, 100).Value = employeeObj.Name; cmd.Parameters.Add("@MobileNo", SqlDbType.VarChar, 50).Value = employeeObj.MobileNo; cmd.Parameters.Add("@Department", SqlDbType.NVarChar, 100).Value = employeeObj.Department; cmd.Parameters.Add("@EmployeeCategory", SqlDbType.NVarChar, 100).Value = employeeObj.EmployeeCategory; cmd.Parameters.Add("@Address", SqlDbType.NVarChar, -1).Value = employeeObj.Address; cmd.Parameters.Add("@EmpType", SqlDbType.VarChar, 5).Value = employeeObj.EmployeeType; cmd.Parameters.Add("@CompanyID", SqlDbType.VarChar, 10).Value = employeeObj.companyID; cmd.Parameters.Add("@GeneralNotes", SqlDbType.NVarChar, -1).Value = employeeObj.GeneralNotes; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = employeeObj.commonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = employeeObj.commonObj.CreatedDate; cmd.Parameters.Add("@IsActive", SqlDbType.Bit).Value = employeeObj.IsActive; cmd.Parameters.Add("@Salary", SqlDbType.Decimal).Value = employeeObj.Salary; cmd.Parameters.Add("@JoiningDate", SqlDbType.DateTime).Value = employeeObj.JoiningDateFormatted; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputID = cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier); outputID.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.InsertFailure); case "1": employeeObj.ID = Guid.Parse(outputID.Value.ToString()); break; default: break; } } catch (Exception ex) { throw ex; } return(employeeObj); }
public object InsertBank(Bank bankObj) { SqlParameter outputStatus, outputCode = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[InsertBank]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Code", SqlDbType.VarChar, 5).Value = bankObj.Code; cmd.Parameters.Add("@Name", SqlDbType.VarChar, 100).Value = bankObj.Name; cmd.Parameters.Add("@CompanyCode", SqlDbType.VarChar, 10).Value = bankObj.CompanyCode; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = bankObj.commonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = bankObj.commonObj.CreatedDate; cmd.Parameters.Add("@ActualODLimit", SqlDbType.Decimal).Value = bankObj.ActualODLimit; cmd.Parameters.Add("@DisplayODLimit", SqlDbType.Decimal).Value = bankObj.DisplayODLimit; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputCode = cmd.Parameters.Add("@CodeOut", SqlDbType.VarChar, 5); outputCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.InsertFailure); case "1": bankObj.Code = outputCode.Value.ToString(); return(new { Code = outputCode.Value.ToString(), Status = outputStatus.Value.ToString(), Message = "InsertSuccess" }); } } catch (Exception ex) { throw ex; } return(new { Code = outputCode.Value.ToString(), Status = outputStatus.Value.ToString(), Message = "InsertSuccess" }); }
public CustomerPayments UpdateCustomerPayments(CustomerPayments _custPayObj) { try { SqlParameter outputStatus = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[UpdateCustomerPayments]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier).Value = _custPayObj.ID; cmd.Parameters.Add("@CustomerID", SqlDbType.UniqueIdentifier).Value = Guid.Parse(_custPayObj.hdfCustomerID); cmd.Parameters.Add("@PaymentDate", SqlDbType.DateTime).Value = _custPayObj.PaymentDate; cmd.Parameters.Add("@ChequeDate", SqlDbType.DateTime).Value = _custPayObj.ChequeDate; cmd.Parameters.Add("@PaymentMode", SqlDbType.VarChar, 10).Value = _custPayObj.PaymentMode; cmd.Parameters.Add("@Type", SqlDbType.VarChar, 1).Value = _custPayObj.hdfType; cmd.Parameters.Add("@CreditID", SqlDbType.UniqueIdentifier).Value = _custPayObj.hdfCreditID; cmd.Parameters.Add("@BankCode", SqlDbType.VarChar, 10).Value = _custPayObj.BankCode; cmd.Parameters.Add("@Refbank", SqlDbType.NVarChar, 50).Value = _custPayObj.ReferenceBank; cmd.Parameters.Add("@DepWithdID", SqlDbType.UniqueIdentifier).Value = _custPayObj.DepWithdID; cmd.Parameters.Add("@PaymentRef", SqlDbType.VarChar, 10).Value = _custPayObj.PaymentRef; cmd.Parameters.Add("@RecdToComanyCode", SqlDbType.VarChar, 10).Value = _custPayObj.RecdToComanyCode; cmd.Parameters.Add("@TotalRecdAmt", SqlDbType.Decimal).Value = _custPayObj.TotalRecdAmt; cmd.Parameters.Add("@AdvanceAmount", SqlDbType.Decimal).Value = _custPayObj.AdvanceAmount; cmd.Parameters.Add("@DetailXml", SqlDbType.NVarChar, -1).Value = _custPayObj.DetailXml; cmd.Parameters.Add("@GeneralNotes", SqlDbType.NVarChar, -1).Value = _custPayObj.GeneralNotes; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = _custPayObj.CommonObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = _custPayObj.CommonObj.UpdatedDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.UpdateFailure); case "1": break; default: break; } } catch (Exception ex) { throw ex; } return(_custPayObj); }
private void OracleListenerCallback(object sender, OracleNotificationEventArgs events) { logger.Info(AppConst.A("OracleListenerCallback Event", events.Info.ToString())); if (events.Info == OracleNotificationInfo.Insert || events.Info == OracleNotificationInfo.Update) { PushSMSToQueue(); } }
public static AppConst Instance() { if (instance == null) { instance = new AppConst(); } return(instance); }
public FollowUp InsertFollowUp(FollowUp followupObj) { try { SqlParameter outputStatus, outputID = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[InsertFollowUp]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@FollowUpDate", SqlDbType.DateTime).Value = followupObj.FollowUpDate; if (followupObj.HdnFollowUpTime == "" || followupObj.HdnFollowUpTime == null) { followupObj.HdnFollowUpTime = "10:00:00"; } cmd.Parameters.Add("@FollowUpTime", SqlDbType.Time).Value = followupObj.HdnFollowUpTime; cmd.Parameters.Add("@CustomerID", SqlDbType.UniqueIdentifier).Value = followupObj.CustomerID; cmd.Parameters.Add("@Status", SqlDbType.VarChar, 150).Value = followupObj.Status; cmd.Parameters.Add("@ContactName", SqlDbType.VarChar, 10).Value = followupObj.ContactName; cmd.Parameters.Add("@Remarks", SqlDbType.VarChar, 250).Value = followupObj.Remarks; cmd.Parameters.Add("@ContactNO", SqlDbType.VarChar, 100).Value = followupObj.ContactNO; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = followupObj.CommonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = followupObj.CommonObj.CreatedDate; outputStatus = cmd.Parameters.Add("@InsertStatus", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputID = cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier); outputID.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.InsertFailure); case "1": followupObj. ID = Guid.Parse(outputID.Value.ToString()); break; default: break; } } catch (Exception ex) { throw ex; } return(followupObj); }
static int GetServer(IntPtr L) { LuaScriptMgr.CheckArgsCount(L, 1); ServerType arg0 = (ServerType)LuaScriptMgr.GetNetObject(L, 1, typeof(ServerType)); ServerEntity o = AppConst.GetServer(arg0); LuaScriptMgr.PushValue(L, o); return(1); }
public SpecialInvPayments InsertSpecialInvPayments(SpecialInvPayments specialObj) { try { SqlParameter outputStatus, outputID, outputGroupID = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[InsertSpecialInvPayments]"; cmd.CommandType = CommandType.StoredProcedure; // cmd.Parameters.Add("@InvoiceID", SqlDbType.UniqueIdentifier).Value = specialObj.InvoiceID; cmd.Parameters.Add("@PaymentDate", SqlDbType.DateTime).Value = specialObj.PaymentDate; // cmd.Parameters.Add("@PaidAmount",SqlDbType.Decimal).Value=specialObj.PaidAmount; cmd.Parameters.Add("@PaymentMode", SqlDbType.VarChar, 10).Value = specialObj.PaymentMode; cmd.Parameters.Add("@RefBank", SqlDbType.VarChar, 50).Value = specialObj.RefBank; cmd.Parameters.Add("@ChequeDate", SqlDbType.DateTime).Value = specialObj.ChequeDate; cmd.Parameters.Add("@Paymentref", SqlDbType.VarChar, 20).Value = specialObj.PaymentRef; cmd.Parameters.Add("@DetailXML", SqlDbType.NVarChar, -1).Value = specialObj.DetailXml; cmd.Parameters.Add("@Remarks", SqlDbType.NVarChar, 250).Value = specialObj.Remarks; cmd.Parameters.Add("@CreatedBy", SqlDbType.VarChar, 250).Value = specialObj.commonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = specialObj.commonObj.CreatedDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputGroupID = cmd.Parameters.Add("@GroupIDOut", SqlDbType.UniqueIdentifier); outputGroupID.Direction = ParameterDirection.Output; //outputID = cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier); //outputID.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.InsertFailure); case "1": // specialObj.ID = new Guid(outputID.Value.ToString()); specialObj.GroupID = new Guid(outputGroupID.Value.ToString()); break; default: break; } } catch (Exception ex) { throw ex; } return(specialObj); }
public async Task <IDictionary <string, object> > SendSMS_QCAsync(string url, string auth, string sender, string msg, string[] listPhone, string sentDate) { IDictionary <string, object> resultData = new Dictionary <string, object>(); resultData.Add(AppConst.ERR_CODE, AppConst.SYS_MSG_EXCEPTION); resultData.Add(AppConst.ERR_CODE_PARTNER, String.Empty); resultData.Add(AppConst.RECEIVE_RESULT, AppConst.SYS_MSG_EXCEPTION); try { IDictionary <string, object> smsQC = new Dictionary <string, object>() { { "Sender", sender }, { "Msg", msg }, { "ListPhone", listPhone }, { "SentDate", sentDate } }; HttpResponseMessage response = await CallAPIAsync(url, auth, JsonConvert.SerializeObject(smsQC)); if (response != null) { string message = await response.Content.ReadAsStringAsync(); // {"Status":"1","Code":null,"Description":null,"CampaignId":"4609afe7-e80c-4b55-905a-1f3b3d4f6ddd"} logger.Info(AppConst.A("SendSMS_QCAsync", url, auth, sender, msg, message)); if (!String.IsNullOrEmpty(message)) { SouthReceiveQCModel southReceiveQC = JsonConvert.DeserializeObject <SouthReceiveQCModel>(message); if (southReceiveQC.Status.Equals("1")) { resultData[AppConst.ERR_CODE] = AppConst.SYS_ERR_OK; resultData[AppConst.ERR_CODE_PARTNER] = southReceiveQC.Status; resultData[AppConst.RECEIVE_RESULT] = southReceiveQC.CampaignId; } else if (!southReceiveQC.Status.Equals("0")) { resultData[AppConst.ERR_CODE] = AppConst.SYS_ERR_UNKNOW; resultData[AppConst.ERR_CODE_PARTNER] = southReceiveQC.Status; resultData[AppConst.RECEIVE_RESULT] = message; } } } } catch (Exception ex) { logger.Error(AppConst.A("SendSMS_QCAsync", url, auth, sender, msg, sentDate, ex)); resultData[AppConst.ERR_CODE] = AppConst.SYS_MSG_EXCEPTION; resultData[AppConst.ERR_CODE_PARTNER] = String.Empty; resultData[AppConst.RECEIVE_RESULT] = AppConst.SYS_MSG_EXCEPTION; } return(resultData); }
public object UpdateDepartment(Department _DepartmentObj) { SqlParameter outputStatus = null; try { using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[UpdateDepartment]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Code", SqlDbType.VarChar, 10).Value = _DepartmentObj.Code; cmd.Parameters.Add("@Name", SqlDbType.VarChar, 100).Value = _DepartmentObj.Name; cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar, 250).Value = _DepartmentObj.commonObj.UpdatedBy; cmd.Parameters.Add("@UpdatedDate", SqlDbType.DateTime).Value = _DepartmentObj.commonObj.UpdatedDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } AppConst Cobj = new AppConst(); switch (outputStatus.Value.ToString()) { case "0": throw new Exception(Cobj.UpdateFailure); case "1": return(new { Status = outputStatus.Value.ToString(), Message = Cobj.UpdateSuccess }); default: break; } } catch (Exception ex) { throw ex; } return(new { Status = outputStatus.Value.ToString(), Message = Cobj.UpdateSuccess }); }
private void OnResDownloadSuccess(byte[] pBytes) { GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, 0f, GameMain.Instance.GetText(5)); string zipPath = AppConst.GetTmpPath("tmp.zip"); File.WriteAllBytes(zipPath, pBytes); m_TotalProgressHandler += OnTotalProgressHandler; m_TotalFinishHandler += OnTotalFinishHandler; FZipUtil.UnzipAsync(zipPath, AppConst.LOCAL_DOWNLOAD_PATH, m_TotalProgressHandler, m_TotalFinishHandler); }
public ChartOfAccounts InsertChartOfAccounts(ChartOfAccounts _chartOfAccountsObj) { try { SqlParameter outputStatus, outputCode = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[InsertChartOfAccounts]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@Code", SqlDbType.VarChar, 10).Value = _chartOfAccountsObj.Code; cmd.Parameters.Add("@Type", SqlDbType.VarChar, 50).Value = _chartOfAccountsObj.Type; cmd.Parameters.Add("@TypeDesc", SqlDbType.VarChar, 200).Value = _chartOfAccountsObj.TypeDesc; //cmd.Parameters.Add("@OpeningPaymentMode", SqlDbType.VarChar, 10).Value = _chartOfAccountsObj.OpeningPaymentMode; //cmd.Parameters.Add("@OpeningBalance", SqlDbType.Decimal).Value = _chartOfAccountsObj.OpeningBalance; //cmd.Parameters.Add("@OpeningAsOfDate", SqlDbType.DateTime).Value = _chartOfAccountsObj.OpeningAsOfDate; cmd.Parameters.Add("@ISEmpApplicable", SqlDbType.Bit).Value = _chartOfAccountsObj.ISEmploy; cmd.Parameters.Add("@IsReverse", SqlDbType.Bit).Value = _chartOfAccountsObj.IsReverse; cmd.Parameters.Add("@IsPurchase", SqlDbType.Bit).Value = _chartOfAccountsObj.IsPurchase; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = _chartOfAccountsObj.CommonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = _chartOfAccountsObj.CommonObj.CreatedDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputCode = cmd.Parameters.Add("@CodeOut", SqlDbType.VarChar, 10); outputCode.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.InsertFailure); case "1": _chartOfAccountsObj.Code = outputCode.Value.ToString(); break; default: break; } } catch (Exception ex) { throw ex; } return(_chartOfAccountsObj); }
public CustomerCreditNotes InsertCustomerCreditNotes(CustomerCreditNotes _customerCreditNotesObj) { try { SqlParameter outputStatus, outputID = null; using (SqlConnection con = _databaseFactory.GetDBConnection()) { using (SqlCommand cmd = new SqlCommand()) { if (con.State == ConnectionState.Closed) { con.Open(); } cmd.Connection = con; cmd.CommandText = "[Accounts].[InsertCustCreditNotes]"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("@OriginComanyCode", SqlDbType.NVarChar, 10).Value = _customerCreditNotesObj.OriginComanyCode; cmd.Parameters.Add("@CRNRefNo", SqlDbType.NVarChar, 20).Value = _customerCreditNotesObj.CreditNoteNo; cmd.Parameters.Add("@CRNDate", SqlDbType.DateTime).Value = _customerCreditNotesObj.CreditNoteDateFormatted; cmd.Parameters.Add("@Amount", SqlDbType.Decimal).Value = _customerCreditNotesObj.Amount; cmd.Parameters.Add("@CreditAmount", SqlDbType.Decimal).Value = _customerCreditNotesObj.CreditAmount; cmd.Parameters.Add("@TaxAmount", SqlDbType.Decimal).Value = _customerCreditNotesObj.TaxAmount; cmd.Parameters.Add("@Type", SqlDbType.VarChar, 5).Value = _customerCreditNotesObj.Type; cmd.Parameters.Add("@GeneralNotes", SqlDbType.NVarChar, -1).Value = _customerCreditNotesObj.GeneralNotes; cmd.Parameters.Add("@CustomerID", SqlDbType.UniqueIdentifier).Value = _customerCreditNotesObj.CustomerID; cmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar, 250).Value = _customerCreditNotesObj.commonObj.CreatedBy; cmd.Parameters.Add("@CreatedDate", SqlDbType.DateTime).Value = _customerCreditNotesObj.commonObj.CreatedDate; outputStatus = cmd.Parameters.Add("@Status", SqlDbType.SmallInt); outputStatus.Direction = ParameterDirection.Output; outputID = cmd.Parameters.Add("@ID", SqlDbType.UniqueIdentifier); outputID.Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); } } switch (outputStatus.Value.ToString()) { case "0": AppConst Cobj = new AppConst(); throw new Exception(Cobj.InsertFailure); case "1": _customerCreditNotesObj.ID = Guid.Parse(outputID.Value.ToString()); break; default: break; } } catch (Exception ex) { throw ex; } return(_customerCreditNotesObj); }
/// <summary> /// Initialize new Worker /// </summary> private void StartWorker() { RabbitHelper rabbitWorker = new RabbitHelper(); rabbitWorker.Initialize(); rabbitWorker.Worker = this.Worker++; rabbitWorker.ReceiveEvent += ReceivedHandlerCallback; rabbitWorker.ReceiveMessage(AppConfig.PARTNER_QUEUE); this.listRabbitWorker.Add(rabbitWorker); logger.Info(AppConst.A("StartWorker", rabbitWorker.Worker, AppConfig.PARTNER_QUEUE, "Started listener!")); }
private static int _CreateAppConst(IntPtr L) { if (LuaDLL.lua_gettop(L) == 0) { AppConst o = new AppConst(); LuaScriptMgr.PushObject(L, o); return(1); } LuaDLL.luaL_error(L, "invalid arguments to method: AppConst.New"); return(0); }
public override void Enter(GameMain pEntity) { base.Enter(pEntity); string path = AppConst.LOCAL_DOWNLOAD_PATH + "HotFix.bin"; if (!File.Exists(path)) { path = AppConst.GetStreemingAssetURL("HotFix.bin"); } DownloadManager.Instance.DownloadFileAsync(path, OnSuccess); }
// 初始化流程 IEnumerator Step_Init() { // 创建日志 Debugger.Create(AppConst.logPath); Debugger.Log("---------------- 游戏开始! ---------------"); Debugger.Log("<Boot> 初始化开始!"); yield return(null); // 初始化基础配置,在初始化资源管理器之前 AppConst.Init(); // 资源管理器,第一步加载 Utils.Add <ResourceManager>(gameObject); yield return(null); // UI管理器 Utils.Add <UIManager>(gameObject); yield return(null); // 加载更新界面 GameObject go = ResourceManager.instance.LoadPrefab("AssetsUpdate", "assetsupdate", "Assets/Res/AssetsUpdate/AssetsUpdate.prefab"); _assetsUpdate = Instantiate(go).GetComponent <AssetsUpdate>(); _assetsUpdate.transform.SetParent(UIManager.instance.GetLayer(0), false); _assetsUpdate.transform.localScale = Vector3.one; _assetsUpdate.transform.localPosition = Vector3.zero; // 文字表初始化 Localization.Init(); yield return(null); // 添加Lua管理器 Utils.Add <LuaManager>(gameObject); yield return(null); // 添加网络管理器 Utils.Add <NetworkManager>(gameObject); yield return(null); // 添加音频管理器 AudioManager.Init(); yield return(null); // 添加更新 Utils.Add <UpdateManager>(gameObject); yield return(null); // 下载线程管理器 Utils.Add <ThreadManager>(gameObject); yield return(0); Debugger.Log("<Boot> 初始化结束!"); }
void Start() { AppConst.PrintPath(); if (!GlobalRef.Init()) { Utility.LogError("Globalref init failed"); return; } StartCoroutine(GlobalRef.AssetMgr.GetAB(AppConst.AB_COMMON, CreateCommonUI)); }
/// <summary> /// 根据productid获取同类目其他商品 /// </summary> /// <param name="productId"></param> /// <param name="topCount">默认取3个</param> /// <returns></returns> public List <ProductModel> GetOtherBuyProductList(string productId, int topCount = 3) { var param = new SqlParameter(); var key = AppConst.Cache_OtherBuyProduct + productId + topCount; var sql = $@"SELECT TOP {topCount} p.ProductID, p.ProductName, p.ProductTitle, p.ProductSubTtile, p.LikeCount, p.CommentCount, p.SeenCount, p.DetailPicCount, p.Status, ac.ACategoryID, bc.BCategoryID, p.UpdateTime, ac.ACategoryName, bc.BCategoryName FROM Product p WITH(nolock) INNER JOIN BCategory bc WITH(nolock) ON bc.BCategoryID = p.BCategoryID INNER JOIN ACategory ac WITH(nolock) ON ac.ACategoryID = bc.ACategoryID WHERE bc.BCategoryID = (SELECT p.BCategoryID FROM Product p WITH(nolock) WHERE p.ProductID = @ProductID) and p.ProductID != @ProductID" ; var cacheResult = (List <ProductModel>)CacheHelper.GetCache(key); if (cacheResult == null) { param.ParameterName = "@ProductID"; param.Value = productId; cacheResult = productDal.QueryCustom <ProductModel>(sql, param); if (cacheResult?.Any() ?? false) { cacheResult.ForEach(p => { p.HeaderImageUrl = AppConst.GetProductHeaderImgUrl(p.ProductID); }); } else { cacheResult = new List <ProductModel>(); } CacheHelper.SetCache(key, cacheResult); } return(cacheResult); }
public override void Enter(GameMain pEntity) { base.Enter(pEntity); pEntity.ShowCheckVersionUI(); //下载本地Main配置 string path = AppConst.GetStreemingAssetURL("Main.json"); DownloadManager.Instance.DownloadFileAsync(path, OnMainFileDownloadSuccess); GameMain.DispatcherEvent(CommonEvents.UpdateCheckVersionProgress, 1f, GameMain.Instance.GetText(1)); }
static int _CreateAppConst(IntPtr L) { int count = LuaDLL.lua_gettop(L); if (count == 0) { AppConst obj = new AppConst(); LuaScriptMgr.PushObject(L, obj); return 1; } else { LuaDLL.luaL_error(L, "invalid arguments to method: AppConst.New"); } return 0; }