protected void Application_Start() { AreaRegistration.RegisterAllAreas(); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); NinjectModule clientModule = new ClientModule(); NinjectModule usertModule = new UserModule(); NinjectModule categoryModule = new CategoryModule(); NinjectModule priceCategoryModule = new PriceCategoryModule(); NinjectModule roomModule = new RoomModule(); NinjectModule reservationModule = new ReservationModule(); NinjectModule dependencyModule = new DependencyModule("HotelModel"); var kernel = new StandardKernel(dependencyModule, usertModule, clientModule, categoryModule, priceCategoryModule, roomModule, reservationModule); DependencyResolver.SetResolver(new NinjectDependencyResolver(kernel)); ControllerBuilder.Current.SetControllerFactory(new NinjectControllerFactory(kernel)); //var kernel = new StandardKernel(clientModule, usertModule, categoryModule, // priceCategoryModule, roomModule, reservationModule, dependencyModule); //kernel.Bind<DefaultFilterProviders>().ToSelf().WithConstructorArgument(GlobalConfiguration.Configuration.Services.GetFilterProviders()); //kernel.Bind<DefaultModelValidatorProviders>().ToConstant(new DefaultModelValidatorProviders(GlobalConfiguration.Configuration.Services.GetModelValidatorProviders())); //GlobalConfiguration.Configuration.DependencyResolver = new Ninject.Web.WebApi.NinjectDependencyResolver(kernel); }
private static void RunProgram(DbDataSource dataSource) { while (true) { var authModule = new AuthModule(dataSource); var authResult = authModule.SignIn(); switch (authResult.Role) { case RoleType.Client: { var clientModule = new ClientModule(authResult.CurrentUserId, dataSource); clientModule.WorkAsClient(); break; } case RoleType.Admin: { var adminModule = new AdminModule(authResult.CurrentUserId, dataSource); adminModule.WorkAsAdmin(); break; } default: { throw new InvalidDataException(); } } } }
public ClientAddressForm(int _id) { id = _id; InitializeComponent(); BLAddress bLAddress = new BLAddress(); dataGridClientAddress.DataSource = bLAddress.Address(id); BLClient bLClient = new BLClient(); ClientModule client = new ClientModule(); client = bLClient.GetClientList(id, "", "", "", "", "")[0]; txtClientName.Text = client.ClientName; txtClientSurname.Text = client.ClientSurname; txtClientCode.Text = client.ClientCode; txtEmail.Text = client.Email; txtPhoneNo.Text = client.PhoneNo; dataGridClientAddress.Columns["ClientId"].Visible = false; dataGridClientAddress.Columns["ClientAddressId"].Visible = false; dataGridClientAddress.Columns["ClientName"].Visible = false; dataGridClientAddress.Columns["ClientSurname"].Visible = false; dataGridClientAddress.Columns["CityName"].HeaderText = "Oras"; dataGridClientAddress.Columns["CountyName"].HeaderText = "Judet"; dataGridClientAddress.Columns["StreetName"].HeaderText = "Nume Strada"; dataGridClientAddress.Columns["StreetNo"].HeaderText = "Numar Strada"; dataGridClientAddress.Columns["status"].Visible = false; dataGridClientAddress.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; }
private static ClientModule?GetClientModule(IReadOnlyList <string> args) { return(args.Count switch { 0 => ClientModule.WithConfigFromIniFile(), 1 => ClientModule.WithConfigFromIniFile(args[0]), _ => ArgError() });
public void AddModule(ClientModule module) { if (module is null) { throw new ArgumentNullException(nameof(module)); } module.RegisterClient(this); }
public BankCardController() { unitOfWork = new InMemoryUnitOfWork(MvcApplication.DataStore); var accountRepository = unitOfWork.GetRepository <Account>(); var clientModule = new ClientModule(unitOfWork.GetRepository <Client>()); var transactionModule = new TransactionModule(unitOfWork.GetRepository <Transaction>()); bankCardModule = new BankCardModule(unitOfWork.GetRepository <BankCard>()); accountModule = new AccountModule(accountRepository, bankCardModule, transactionModule, clientModule); }
void Awake() { if (Singleton != null) { Destroy(gameObject); return; } DontDestroyOnLoad(gameObject); Singleton = this; }
private void DataGridClient_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) { //ClientAddressForm clientAddressForm = new ClientAddressForm(); //clientAddressForm.Show(); //this.Hide(); //string clientName = textBoxPartener.Text; //BLGetClientList bLGetClient = new BLGetClientList(); //int e1 = e.RowIndex; //List<ClientModule> list = bLGetClient.GetClientList(clientName); //this.id = Convert.ToInt32( dataGridClient.Rows[e.RowIndex].Cells[0].Value); //textBoxPartener.Text = this.id.ToString(); this.Hide(); ClientModule client = (ClientModule)dataGridClient.SelectedRows[0].DataBoundItem; ClientAddressForm clientAddressForm = new ClientAddressForm(client.ClientId); clientAddressForm.Show(); clientAddressForm.FormClosed += ClientAddressForm_FormClosed; }
//private void BtnModify_Click(object sender, EventArgs e) //{ // if (dataGridClient.SelectedRows.Count == 0) // { // MessageBox.Show("Trebuie sa selectati un client."); // return; // } // else // { // ClientModule client = (ClientModule)dataGridClient.SelectedRows[0].DataBoundItem; // UpdateClientForm updateClientForm = new UpdateClientForm(client.ClientId); // updateClientForm.Show(); // this.Hide(); // updateClientForm.FormClosed += UpdateClientForm_FormClosed; // } //} //private void UpdateClientForm_FormClosed(object sender, FormClosedEventArgs e) //{ // this.Close(); //} private void BtnDelete_Click(object sender, EventArgs e) { if (dataGridClient.SelectedRows.Count == 0) { MessageBox.Show("Trebuie sa selectati un client."); return; } BLClient bLClient = new BLClient(); ClientModule client = (ClientModule)dataGridClient.SelectedRows[0].DataBoundItem; //UpdateClientForm updateClientForm = new UpdateClientForm(client.ClientId); if (MessageBox.Show("Sunteti sigur ca vreiti sa stergeti clientul " + client.ClientName + " " + client.ClientSurname + "?", "Mesaj de avertizare!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { bLClient.DeleteClient(client.ClientId); MessageBox.Show(client.ClientName + " " + client.ClientSurname + " a fost sters cu succes."); List <ClientModule> list = bLClient.GetClientList(-1, "", "", "", "", ""); dataGridClient.DataSource = list; } else { return; } }
public TConfigType AddModule(ClientModule module) { _modules.Add(module); return((TConfigType)(object)this); }
private void LoadEditedSkills(int targetId) { PlayerPrefs.SetInt("TargetId", targetId); PlayerPrefs.Save(); SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt")); CopyTableAndDslFiles(); ClientModule.LoadTableConfig(); PredefinedSkill.Instance.ReBuild(); GfxSkillSystem.Instance.Reset(); GfxSkillSystem.Instance.ClearSkillInstancePool(); SkillSystem.SkillConfigManager.Instance.Clear(); GameObject actor = GameObject.Find("Editor_ActorRecord"); GameObject skills = GameObject.Find("Editor_SkillRecords"); if (null != actor && null != skills) { ActorRecord actorRecord = actor.GetComponent <ActorRecord>(); SkillRecords skillRecords = skills.GetComponent <SkillRecords>(); if (null != actorRecord && null != skillRecords) { List <int> args = new List <int>(); int actorId = actorRecord.id; if (actorRecord.skill0 > 0) { args.Add(actorRecord.skill0); } if (actorRecord.skill1 > 0) { args.Add(actorRecord.skill1); } if (actorRecord.skill2 > 0) { args.Add(actorRecord.skill2); } if (actorRecord.skill3 > 0) { args.Add(actorRecord.skill3); } if (actorRecord.skill4 > 0) { args.Add(actorRecord.skill4); } if (actorRecord.skill5 > 0) { args.Add(actorRecord.skill5); } if (actorRecord.skill6 > 0) { args.Add(actorRecord.skill6); } if (actorRecord.skill7 > 0) { args.Add(actorRecord.skill7); } if (actorRecord.skill8 > 0) { args.Add(actorRecord.skill8); } RebuildVisualSkillInfo(actorId); bool isValid = true; if (string.IsNullOrEmpty(actorRecord.avatar)) { Debug.LogErrorFormat("actor avatar is empty !!!"); isValid = false; } foreach (int skillId in args) { CheckEditedSkill(skillId, skillRecords.records, ref isValid); } if (isValid) { TableConfig.Actor actorInfo = TableConfig.ActorProvider.Instance.GetActor(actorId); if (null == actorInfo) { actorInfo = new TableConfig.Actor(); actorInfo.id = actorId; TableConfig.ActorProvider.Instance.ActorMgr.GetData().Add(actorId, actorInfo); } actorRecord.CopyTo(actorInfo); foreach (SkillRecords.SkillRecord record in skillRecords.records) { TableConfig.Skill skillInfo = TableConfig.SkillProvider.Instance.GetSkill(record.id); if (null == skillInfo) { skillInfo = new TableConfig.Skill(); skillInfo.id = record.id; TableConfig.SkillProvider.Instance.SkillMgr.GetData().Add(record.id, skillInfo); } record.CopyTo(skillInfo); } if (args.Count > 1) { GfxStorySystem.Instance.SendMessage("reload", actorId, targetId, args); } } } UnityEditor.EditorUtility.DisplayDialog("提示", "编辑英雄与技能加载完毕", "ok"); } }
private void NewEditedSkills() { if (UnityEditor.EditorUtility.DisplayDialog("关键信息", "加载或创建英雄技能数据将覆盖正在编辑的数据,继续吗?(如果之前的数据没有保存到表格文件里,请利用剪贴板拷到表格文件!)", "我确定要继续", "不要继续,我还没保存呢")) { SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt")); ClientModule.LoadTableConfig(); PredefinedSkill.Instance.ReBuild(); GfxSkillSystem.Instance.Reset(); GfxSkillSystem.Instance.ClearSkillInstancePool(); SkillSystem.SkillConfigManager.Instance.Clear(); GameObject actor = GameObject.Find("Editor_ActorRecord"); GameObject skills = GameObject.Find("Editor_SkillRecords"); if (null != actor && null != skills) { ActorRecord actorRecord = actor.GetComponent <ActorRecord>(); SkillRecords skillRecords = skills.GetComponent <SkillRecords>(); if (null != actorRecord && null != skillRecords) { int skillCount = 0; List <int> skillIds = new List <int>(); if (actorRecord.skill0 > 0) { ++skillCount; skillIds.Add(actorRecord.skill0); } if (actorRecord.skill1 > 0) { ++skillCount; skillIds.Add(actorRecord.skill1); } if (actorRecord.skill2 > 0) { ++skillCount; skillIds.Add(actorRecord.skill2); } if (actorRecord.skill3 > 0) { ++skillCount; skillIds.Add(actorRecord.skill3); } if (actorRecord.skill4 > 0) { ++skillCount; skillIds.Add(actorRecord.skill4); } if (actorRecord.skill5 > 0) { ++skillCount; skillIds.Add(actorRecord.skill5); } if (actorRecord.skill6 > 0) { ++skillCount; skillIds.Add(actorRecord.skill6); } if (actorRecord.skill7 > 0) { ++skillCount; skillIds.Add(actorRecord.skill7); } if (actorRecord.skill8 > 0) { ++skillCount; skillIds.Add(actorRecord.skill8); } RebuildVisualSkillInfo(actorRecord.id); skillRecords.records.Clear(); for (int i = 0; i < skillCount; ++i) { AddViewedSkill(skillIds[i], skillRecords.records); } } } } UnityEditor.EditorUtility.DisplayDialog("提示", "技能数据加载/创建完毕", "ok"); }
private void LoadViewedSkills(object[] fargs) { if (null != fargs && fargs.Length == 2) { int actorId = (int)fargs[0]; int targetId = (int)fargs[1]; PlayerPrefs.SetInt("ActorId", actorId); PlayerPrefs.SetInt("TargetId", targetId); PlayerPrefs.Save(); if (UnityEditor.EditorUtility.DisplayDialog("关键信息", "从文件加载数据将同时覆盖正在编辑的数据,继续吗?(如果之前的数据没有保存到表格文件里,请利用剪贴板拷到表格文件!)", "我确定要继续", "不要继续,我还没保存呢")) { SaveEditedSkills(HomePath.GetAbsolutePath("../../../edit_skills_bak.txt")); CopyTableAndDslFiles(); m_CameraController.OnLevelWasLoaded(null); ClientModule.LoadTableConfig(); PredefinedSkill.Instance.ReBuild(); GfxSkillSystem.Instance.Reset(); GfxSkillSystem.Instance.ClearSkillInstancePool(); SkillSystem.SkillConfigManager.Instance.Clear(); GameObject actor = GameObject.Find("Editor_ActorRecord"); GameObject skills = GameObject.Find("Editor_SkillRecords"); if (null != actor && null != skills) { ActorRecord actorRecord = actor.GetComponent <ActorRecord>(); SkillRecords skillRecords = skills.GetComponent <SkillRecords>(); if (null != actorRecord && null != skillRecords) { TableConfig.Actor actorInfo = TableConfig.ActorProvider.Instance.GetActor(actorId); if (null != actorInfo) { List <int> args = new List <int>(); if (actorInfo.skill0 > 0) { args.Add(actorInfo.skill0); } if (actorInfo.skill1 > 0) { args.Add(actorInfo.skill1); } if (actorInfo.skill2 > 0) { args.Add(actorInfo.skill2); } if (actorInfo.skill3 > 0) { args.Add(actorInfo.skill3); } if (actorInfo.skill4 > 0) { args.Add(actorInfo.skill4); } if (actorInfo.skill5 > 0) { args.Add(actorInfo.skill5); } if (actorInfo.skill6 > 0) { args.Add(actorInfo.skill6); } if (actorInfo.skill7 > 0) { args.Add(actorInfo.skill7); } if (actorInfo.skill8 > 0) { args.Add(actorInfo.skill8); } RebuildVisualSkillInfo(actorId); actorRecord.CopyFrom(actorInfo); skillRecords.records.Clear(); foreach (int skillId in args) { AddViewedSkill(skillId, skillRecords.records); } GfxStorySystem.Instance.SendMessage("reload", actorId, targetId, args); } } } UnityEditor.EditorUtility.DisplayDialog("提示", "从文件加载英雄与技能完毕", "ok"); } } }
public void Save(int id) { BLClient bl = new BLClient(); if (id != 0) { List <ClientModule> listUpdate = bl.GetClientList(id, "", "", "", "", ""); ClientModule client = listUpdate[0]; string clientName = txtClientName.Text; string clientSurname = txtClientSurname.Text; string clientCode = txtClientCode.Text; string email = txtEmail.Text; string phoneNo = txtPhoneNo.Text; if (!(clientName == client.ClientName & clientSurname == client.ClientSurname & clientCode == client.ClientCode & email == client.Email & phoneNo == client.PhoneNo)) { foreach (char c in txtPhoneNo.Text.ToCharArray()) { if (!(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7' || c == '8' || c == '9')) { MessageBox.Show("Tnumarul de telefon trebuie sa contina doar cife.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (!(new EmailAddressAttribute().IsValid(txtEmail.Text)) & !String.IsNullOrWhiteSpace(txtEmail.Text)) { MessageBox.Show("Emailul trebuie sa fie valid!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } //txtClientCode.TextChanged bool status = false; if (clientCode == client.ClientCode) { bl.UpdateClient(id, clientName, clientSurname, "", phoneNo, email, out status); } else { bl.UpdateClient(id, clientName, clientSurname, clientCode, phoneNo, email, out status); } //BLClient bl = new BLClient(); if (status) { MessageBox.Show("Modificare reusita."); } else { MessageBox.Show("Codul de client exista deja!"); return; } } BLAddress bLAddress = new BLAddress(); //List<AddressModel> list= new List<AddressModel>(); //list = bLAddress.Address(id); for (int i = 0; i < dataGridClientAddress.Rows.Count; i++) { AddressModel addressModel = new AddressModel(); addressModel = (AddressModel)dataGridClientAddress.Rows[i].DataBoundItem; if (addressModel.status == 1) { bLAddress.AddAddress(id, addressModel.CityName, addressModel.CountyName, addressModel.StreetName, addressModel.StreetNo); } //INSERT if (addressModel.status == 2) { bLAddress.UpdateAddress(id, addressModel.ClientAddressId, addressModel.CityName, addressModel.CountyName, addressModel.StreetName, addressModel.StreetNo); } //UPDATE if (addressModel.status == 3) { bLAddress.DeleteAddress(addressModel.ClientId, addressModel.ClientAddressId); } } } else { if (String.IsNullOrWhiteSpace(txtClientName.Text)) { MessageBox.Show("Numele clientului este obligatoriu", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtClientSurname.Text)) { MessageBox.Show("Prenumele utilizatorului eate obligatoriu", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(txtClientCode.Text)) { MessageBox.Show("codul de client este obligatoriu", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } foreach (char c in txtPhoneNo.Text.ToCharArray()) { if (!(c == '0' || c == '1' || c == '2' || c == '3' || c == '4' || c == '5' || c == '6' || c == '7' || c == '8' || c == '9')) { MessageBox.Show("Numarul de telefon trebuie sa contina doar cife.", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } if (!(new EmailAddressAttribute().IsValid(txtEmail.Text)) & !String.IsNullOrWhiteSpace(txtEmail.Text)) { MessageBox.Show("Emailul trebuie sa fie valid!", "Eroare", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string clientName = txtClientName.Text; string clientSurname = txtClientSurname.Text; string clientCode = txtClientCode.Text; string phoneNo = String.IsNullOrWhiteSpace(txtPhoneNo.Text) ? null : txtPhoneNo.Text; string email = String.IsNullOrWhiteSpace(txtEmail.Text) ? null : txtEmail.Text;; bool status = true; bl.AddClient(clientName, clientSurname, clientCode, phoneNo, email, out status); if (status) { MessageBox.Show("Clientul " + clientName + " " + clientSurname + " a fost adaugat cu succes"); List <ClientModule> list = bl.GetClientList(-1, "", "", clientCode, "", ""); Save(list[0].ClientId);//RECURSIVITATE } //MessageBox.Show("Clientul " + clientName + " " + clientSurname + " a fost adaugat cu succes"); else { MessageBox.Show("Codul de client exista deja!"); } } }