public void EquipSellClick(EquipInfoView equipInfoView) { if (selectedData != null) { PlayerData playData = EquipModel.SellPlayerEquip(selectedData); finalData = StaticDataModel.ReadEquipMerge(playData.equips); equiplistView.DisPlay_Choice(finalData, this, 1); bool isContains = false; for (int i = 0; i < finalData.Count; i++) { if (finalData[i].equipmentID == selectedData.equipmentID && finalData[i].strLevel == selectedData.strLevel) { isContains = true; break; } } if (!isContains) { selectedData = null; Destroy(equipInfoView.gameObject); return; } Num.text = playData.equips.Count + "/" + kucun; equipInfoView.count.text = (selectedData.count - 1).ToString(); } }
public BaseEquipmentController(EquipModel model = null) { if (model != null) { Init(model); } }
// Vector3 originPoint; // Vector3 endPoint; public override void Init() { base.Init(); equipModel = ModelManager.Get("EquipModel") as EquipModel; layer = GameLayer.UI; // originPoint = new Vector3(0, -306f, 0); // endPoint = new Vector3(0, 303.6f, 0); }
/// <summary> /// 卸下装备更新数据 /// </summary> /// <param name="_item"></param> public static void UnloadEquip(Item _item) { EquipModel gm = EquipList.Find(x => x.Id == _item.item_ID); EquipList.Remove(gm); Item item = DataMgr.GetInstance().GetItemByID(gm.Id); BuyItem(item); UpdateUser(); SaveEquip(); }
void EquipItem(EquipModel equipModel) { GameObject go = ObjectPool.instance.GetObject(equipModel.data); if (go == null) { Debug.Log(string.Format("Can't equip item. No prefab found:" + equipModel.data.prefabName)); return; } InstantiateItem(go); }
//获得新装备 public bool AddEquip(Equip equip) { Equip curEquip = equips[equip.equipType]; if (curEquip != null) { //curEquip.UnLoad(this); if (curEquip.level > equip.level) { WndTips.ShowTips("不可替换为低等级的装备!"); return(false); } else { AudioManager.instance.PlayEffect(ConstConfig.UpEquip); EquipModel equipModel = ModelManager.Get <EquipModel>("EquipModel"); curEquip.UnLoad(this); equipModel.AddEquip(curEquip); equips[equip.equipType] = equip; equip.Load(this); OnUpdateEquip?.Invoke(); return(true); } } else if (equip.level > cost && isLevelEffect == true) { WndTips.ShowTips("装备等级不能低于角色品质."); return(false); } else { AudioManager.instance.PlayEffect(ConstConfig.UpEquip); equips[equip.equipType] = equip; equip.Load(this); OnUpdateEquip?.Invoke(); return(true); } //return curEquip; }
public void SetPar(Transform trans, EquipModel item) { GameObject go = GameObject.Instantiate(itemPrefab); go.transform.SetParent(trans); go.GetComponent <RectTransform>().sizeDelta = new Vector2(50, 50); go.transform.localPosition = Vector3.zero; go.transform.localScale = Vector3.one; Sprite tempSprite = Resources.Load <Sprite>("Image/" + item.Id); go.GetComponent <Image>().sprite = tempSprite; Item gm = DataMgr.GetInstance().GetItemByID(item.Id); go.GetComponent <BagItem>().Init(gm, tempSprite); }
public void RankUPClick(EquipInfoView equipInfoView) { RowEquipment equipDate = selectedData; PlayerData newList = EquipModel.StrLevelUp(equipDate); finalData = StaticDataModel.ReadEquipMerge(newList.equips); equiplistView.DisPlay_Choice(finalData, this, 1); TeamModel.EquioStrChange(); Num.text = newList.equips.Count + "/" + kucun; equipInfoView.Display(selectedData, this); }
private void GdEquip_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (gdEquip.SelectedIndex != -1) { EquipModel eq = gdEquip.Items[gdEquip.SelectedIndex] as EquipModel; if (eq == null) { return; } string sqlstr = "SELECT r.*,i.term,s.scheme_name FROM plc_scheme.test_result r left join plc_scheme.test_scheme s on r.task_id = s.task_id " + $" left join plc_scheme.test_term i on r.item = i.id where r.module_barcode = '{eq.BAR_CODE}'"; DataTable dtbl = MySQLHelper.SQLSelect(sqlstr); List <TestResultModel> lstRlts = new List <TestResultModel>(); if (dtbl != null && dtbl.Rows.Count > 0) { foreach (DataRow dr in dtbl.Rows) { TestResultModel rlt = new TestResultModel() { scheme_name = dr["scheme_name"].ToString(), module_barcode = dr["module_barcode"].ToString(), result = dr["result"].ToString(), result_data = dr["result_data"].ToString(), term = dr["term"].ToString(), }; if (rlt.result == "1") { rlt.result = "合格"; } else if (rlt.result == "2") { rlt.result = "不合格"; } else { rlt.result = "未检测"; } if (rlt.term.Contains("功耗") && rlt.result_data != "不通过") { rlt.result_data += " W"; } lstRlts.Add(rlt); } } gdTestRlt.ItemsSource = lstRlts; } }
/// <summary> /// 使用物品时装备栏更新和人物属性更新 /// </summary> /// <param name="_item">要使用的物品</param> public static void UseItem(Item _item) { if (equipList == null) { equipList = new List <EquipModel>(); } GoodsModel gm = GoodsList.Find(x => x.Id == _item.item_ID); //在背包找到这个物品 if (gm.Num <= 1) //使用了这个物品,背包要移除这个物品 { GoodsList.Remove(gm); //如果背包栏这个物品数据为1则移除这个物品 } else { gm.Num -= 1; //如果这个物品数据大于1则数量减一 } if (_item.equipment_Type != Equipment_Type.Null) //判断这个物品是不是装备 { //判断背包栏是不是有这个类型的武器,类型是穿戴在武器穿戴的位置 EquipModel em = EquipList.Find(x => x.Equipment_Type == _item.equipment_Type); if (em != null) //如果这个位置已经有物体就要替换 { em.Value += 1; //如果这个位置有物体了,让这个物体的数量加1 if (em.Value > 1) //看这个位置的物体数量是不是1,如果大于一则移除这个物体 { EquipList.Remove(em); //在武器数据中移除这个数据 Item item = DataMgr.GetInstance().GetItemByID(em.Id); //在数据库中找到移除的这个物体 BuyItem(item); //将他保存回背包数据中 } } //给背包数据添加这个新的要使用的物品,达到替换的效果 equipList.Add(new EquipModel() { Id = _item.item_ID, Equipment_Type = _item.equipment_Type, Value = 1 }); } else { if (saveUser[0].Hp < saveUser[0].MaxHp) { saveUser[0].Hp += _item.hp; } } SaveEquip(); }
internal void Release() { onEquipItem = delegate { }; onUnequipItem = delegate { }; equipModel = null; }
//获得关卡奖励(不包括金币,金币奖励在 playerData类中处理) void GetReward(dynamic dy) { GameLevelModel gameLevel = ModelManager.Get <GameLevelModel>("GameLevelModel"); EquipModel equipModel = ModelManager.Get <EquipModel>("EquipModel"); int curLevel = gameLevel.GetLevel(); if (curLevel % ConstConfig.equipRewardLevel == 0) { //获得装备奖励 //第一个装备的id为1,随机直接int里随机 //获得随机3件装备 List <Equip> equipIds = new List <Equip>(MaxEquipReward); //概率 30 30 20 10 10 int gailv1 = 30; //1-30 int gailv2 = 60; //31-60 int gailv3 = 80; //61-80 int gailv4 = 90; //81-90 int gailv5 = 100; //91-100 for (int i = 0; i < MaxEquipReward; i++) { int randomRes = Random.Range(1, 101); int resLevel = 0; if (randomRes >= 1 && randomRes <= gailv1) { resLevel = 1; } else if (randomRes >= gailv1 + 1 && randomRes <= gailv2) { resLevel = 2; } else if (randomRes >= gailv2 + 1 && randomRes <= gailv3) { resLevel = 3; } else if (randomRes >= gailv3 + 1 && randomRes <= gailv4) { resLevel = 4; } else if (randomRes >= gailv4 + 1 && randomRes <= gailv5) { resLevel = 5; } var targetIds = EquipModel.equipIds[resLevel]; int id = targetIds[Random.Range(0, targetIds.Count)]; Equip e = new Equip(id); equipIds.Add(e); equipModel.AddEquip(e); } ViewManager.Get <WndFightOver>("WndFightOver").ShowEquipReward(equipIds); } if (curLevel % ConstConfig.talentRewardLevel == 0) { if (ModelManager.Get <TalentModel>("TalentModel").canUseTalent.Count > 0) { ViewManager.Get("WndTalent").SetVisible(true); } } }
public void Unequip() { equipModel.Unequip(); equipModel = null; }
public void Equip(EquipData equipData) { equipModel = EquipFactory.Create(_itemToEquip); onEquipItem.Invoke(equipModel); }
public virtual void Init(EquipModel model) { equipModel = model; equipModel.onUnequip += OnUnequip; }
public virtual void Release() { onUnequipComplete = delegate { }; equipModel = null; }
//检测总量统计 private void showCount_Click(object sender, RoutedEventArgs e) { //数据库查找数据 //string sqlstring = "SELECT * FROM plc_scheme.mt_detect_out_equip where 1=1 "; string sqlstring = "select * from (SELECT module_barcode,max(date) as date,max(test_operator) as test_operator FROM plc_scheme.test_result group by module_barcode ) as b " + "left join plc_scheme.mt_detect_out_equip as e on b.module_barcode = e.BAR_CODE where 1=1 "; if (!string.IsNullOrEmpty(txtTaskNo.Text)) { sqlstring += $" and DETECT_TASK_NO like '%{txtTaskNo.Text}%' "; } if (!string.IsNullOrEmpty(txtBarcode.Text)) { sqlstring += $" and BAR_CODE like '%{txtBarcode.Text}%' "; } if (FromDate.SelectedDate.HasValue) { sqlstring += $" and date >= '{FromDate.SelectedDate.Value.ToString("yyyy-MM-dd 00:00:00")}' ";//date(YQ_date) } if (ToDate.SelectedDate.HasValue) { sqlstring += $" and date <= '{ToDate.SelectedDate.Value.ToString("yyyy-MM-dd 23:59:59")}' ";// date(YQ_date) } DataTable dtbl = MySQLHelper.SQLSelect(sqlstring); _SearchedEqs = new List <EquipModel>(); if (dtbl != null && dtbl.Rows.Count > 0) { foreach (DataRow dr in dtbl.Rows) { EquipModel eq = new EquipModel() { BAR_CODE = dr["module_barcode"]?.ToString(), DETECT_TASK_NO = dr["DETECT_TASK_NO"]?.ToString(), HPLC_CERT_CONC_CODE = dr["HPLC_CERT_CONC_CODE"]?.ToString(), POSITION_NO = dr["POSITION_NO"]?.ToString(), YQ_date = dr["date"]?.ToString(), YQ_FINISH_FLAG = dr["YQ_FINISH_FLAG"]?.ToString(), YQ_RSLT_FLAG = dr["YQ_RSLT_FLAG"]?.ToString(), YQ_TEST_OPERATOR = dr["test_operator"]?.ToString(), }; if (eq.HPLC_CERT_CONC_CODE == "01") { eq.HPLC_CERT_CONC_CODE = "成功"; } else if (eq.HPLC_CERT_CONC_CODE == "02") { eq.HPLC_CERT_CONC_CODE = "失败"; } else if (eq.HPLC_CERT_CONC_CODE == "03") { eq.HPLC_CERT_CONC_CODE = "未检测"; } if (eq.YQ_RSLT_FLAG == "01") { eq.YQ_RSLT_FLAG = "合格"; } else if (eq.YQ_RSLT_FLAG == "02") { eq.YQ_RSLT_FLAG = "合格"; } else if (eq.YQ_RSLT_FLAG == "03") { eq.YQ_RSLT_FLAG = "未检测"; } _SearchedEqs.Add(eq); } } gdEquip.ItemsSource = _SearchedEqs; ZongLiang.Content = "当前查询条件下的总量是:" + _SearchedEqs.Count; }
public EquipPresenter(params object[] param) : base(param) { model = new EquipModel(); }
/// <summary> /// The on step async. /// </summary> /// <param name="stepName"> /// The step name. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public override async Task OnStepAsync(object stepName) { this.CurrentStep = (Asset.EnumSteps)Enum.Parse(typeof(Asset.EnumSteps), stepName.ToString()); switch (this.CurrentStep) { case Asset.EnumSteps.Start: this.SetBusyAction(LoadingText); this.ActiveViewModel = this; this.GetPermission(); await this.GetDataSourceForGrid(); this.ResetBusyAction(); this.IsAdd = false; this.SetActionCommandsAsync(); break; case Asset.EnumSteps.SelectModel: this.SetBusyAction(LoadingText); this.AssetModelDetail.GridStyle = (Brush)Application.Current.FindResource("GridStyleNotEdit"); this.RaiseActionsWhenChangeStep( EnumScreen.AssetClassesModel, Asset.EnumSteps.SelectModel, this.SelectedModel); this.AssetModelDetail.PopulateAllField(); this.ResetBusyAction(); this.SetActionCommandsAsync(); break; case Asset.EnumSteps.Add: this.IsAdd = true; EquipModel newModel = new EquipModel { IsNewModel = true, Enabled = true }; await this.SetSelectedModelAsync(newModel); this.RaiseActionsWhenChangeStep(EnumScreen.AssetClassesModel, Asset.EnumSteps.Add); await this.OnStepAsync(Asset.EnumSteps.Edit); this.SetActionCommandsAsync(); break; case Asset.EnumSteps.Edit: if (await this.LockAsync() == false) { this.RaiseActionsWhenChangeStep(EnumScreen.Users, Asset.EnumSteps.ItemLocked); this.AssetModelDetail.GridStyle = (Brush)Application.Current.FindResource("GridStyleNotEdit"); await this.OnStepAsync(Asset.EnumSteps.SelectModel); } else { this.AssetModelDetail.GridStyle = (Brush)Application.Current.FindResource("GridStyleEdit"); this.RaiseActionsWhenChangeStep(EnumScreen.AssetClassesModel, Asset.EnumSteps.Edit); this.AssetModelDetail.IsCheckedOut = true; this.SetEnableComboBox(true); this.SetActionCommandsAsync(); } break; case Asset.EnumSteps.Cancel: bool canProcess; canProcess = this.CheckIfUnSavedChanges(); if (canProcess) { var assetModelDetailViewModel = this.AssetModelDetail; if (assetModelDetailViewModel != null) { assetModelDetailViewModel.IsCheckedOut = false; this.SetEnableComboBox(false); assetModelDetailViewModel.IsChanged = false; } if (!this.SelectedModel.IsNewModel) { await this.UnLockAsync(); this.SelectedModel = await AssetModelFunctions.GetEquipModelDetail(this.SelectedModel.EquipModelId); } this.ValidateNotError(); this.RaiseActionsWhenChangeStep(EnumScreen.AssetClassesModel, Asset.EnumSteps.Cancel); if (this.SelectedModel.IsNewModel) { this.OnCancelNewItem(EnumScreen.AssetClassesModel); await this.OnStepAsync(Asset.EnumSteps.GridSummaryState); } } this.SetActionCommandsAsync(); break; case Asset.EnumSteps.Save: this.Validate(); if (this.HasErrors == false) { this.IsAdd = false; this.ValidateNotError(); await Task.WhenAll(this.GetSelectedMake(), this.GetSelectedType(), this.GetSelectedCategory()); string previousModel = this.SelectedModel.Description; this.SelectedModel.Description = this.AssetModelDetail.ModelDescription; this.SelectedModel.Enabled = this.AssetModelDetail.ModelEnabled; await AssetModelFunctions.SaveAsync( this.SelectedModel, this.SelectedMake, this.SelectedType, this.SelectedCategory); if (!this.SelectedModel.IsNewModel) { await this.UnLockAsync(); await this.GetAllModel(); this.UpdateSourceForGrid(previousModel); } else { this.AssetModelDetail.IsCheckedOut = false; this.SetEnableComboBox(false); this.AssetModelDetail.IsChanged = false; AssetClassesModelRowItem addModel = new AssetClassesModelRowItem { EquipModelId = this.SelectedModel.EquipModelId, Description = this.SelectedModel.Description, Enabled = this.SelectedModel.Enabled, IsMouseHover = this.SelectedModel.Enabled, }; this.AllAssetModel.Add(addModel); this.UpdateSourceForGrid(); } this.AssetModelDetail.ResetSelectedComboBox(); this.AssetModelDetail.ModelId = this.SelectedItem.EquipModelId; this.AssetModelDetail.PopulateAllField(); this.SelectedModel.IsNewModel = false; this.AssetModelDetail.IsCheckedOut = false; this.SetEnableComboBox(false); this.AssetModelDetail.IsChanged = false; this.AssetModelDetail.GridStyle = (Brush)Application.Current.FindResource("GridStyleNotEdit"); this.RaiseActionsWhenChangeStep(EnumScreen.AssetClassesModel, Asset.EnumSteps.Save, this.SelectedModel); } else { this.CurrentStep = Asset.EnumSteps.Error; this.OnErrorHyperlinkSelected(); } this.SetActionCommandsAsync(); break; case Asset.EnumSteps.Error: // Show NotificationWindow when click Error button. NotificationErrorView errorPopup = new NotificationErrorView(); NotificationErrorViewModel errorPopupViewModel = new NotificationErrorViewModel(); errorPopupViewModel.listCustomHyperlink = this.ListErrorHyperlink; errorPopup.DataContext = errorPopupViewModel; errorPopup.Style = (Style)Application.Current.FindResource("RadWindowStyleNew"); errorPopup.ShowDialog(); this.SetActionCommandsAsync(); break; case Asset.EnumSteps.SaveAndAdd: await this.OnStepAsync(Asset.EnumSteps.Save); if (this.HasErrors == false) { await this.OnStepAsync(Asset.EnumSteps.Add); } this.SetActionCommandsAsync(); break; case Asset.EnumSteps.GridSummaryState: this.DynamicAssetClassModelViewModel.IsEnableHoverRow = false; if (this.DynamicAssetClassModelViewModel.SelectedRows != null) { this.DynamicAssetClassModelViewModel.SelectedRows = new List<object>(); } this.StepChanged("MainGridState"); this.SetActionCommandsAsync(); break; } }
private void CSVButton_Click(object sender, RoutedEventArgs e) { if (_SearchedEqs.Count == 0) { return; } if (gdEquip.SelectedIndex == -1) { MessageBox.Show("请选择【有任务号】的记录!"); return; } EquipModel selEq = gdEquip.Items[gdEquip.SelectedIndex] as EquipModel; if (selEq == null || string.IsNullOrEmpty(selEq.DETECT_TASK_NO)) { MessageBox.Show("请选择【有任务号】的记录!"); return; } string taskNo = selEq.DETECT_TASK_NO; //查询检测项名称,构造数据列 string strSearchName = "SELECT t.term FROM plc_scheme.test_result r inner join plc_scheme.test_term t on r.item = t.id " + " where r.module_barcode in (select e.BAR_CODE from plc_scheme.mt_detect_out_equip e where e.DETECT_TASK_NO = '" + taskNo + "') " + " group by t.id,t.term order by t.id "; var dtblColName = MySQLHelper.SQLSelect(strSearchName); if (dtblColName == null && dtblColName.Rows.Count == 0) { MessageBox.Show("无检测数据!"); return; } DataTable dtblCVS = new DataTable(); dtblCVS.Columns.Add("行号", typeof(string)); dtblCVS.Columns.Add("任务号", typeof(string)); dtblCVS.Columns.Add("条码", typeof(string)); dtblCVS.Columns.Add("检测人员", typeof(string)); dtblCVS.Columns.Add("检测结论", typeof(string)); dtblCVS.Columns.Add("检测时间", typeof(string)); dtblCVS.Columns.Add("工位", typeof(string)); foreach (DataRow dataRow in dtblColName.Rows)//添加检测项列名 { dtblCVS.Columns.Add(dataRow[0].ToString(), typeof(string)); } int lineNo = 0; foreach (var eq in _SearchedEqs) { if (eq.DETECT_TASK_NO != selEq.DETECT_TASK_NO) { continue; } lineNo++; DataRow dr = dtblCVS.NewRow(); dtblCVS.Rows.Add(dr); dr["行号"] = "\t" + lineNo; dr["任务号"] = "\t" + eq.DETECT_TASK_NO; dr["条码"] = "\t" + eq.BAR_CODE; dr["检测人员"] = "\t" + eq.YQ_TEST_OPERATOR; dr["检测结论"] = "\t" + eq.YQ_RSLT_FLAG; dr["检测时间"] = "\t" + eq.YQ_date; dr["工位"] = "\t" + eq.POSITION_NO; try { string strSearchRlt = "SELECT t.term,r.result_data,r.result FROM plc_scheme.test_result r inner join plc_scheme.test_term t on r.item = t.id " + " where r.module_barcode = '" + eq.BAR_CODE + "' "; var dtblRlt = MySQLHelper.SQLSelect(strSearchRlt); if (dtblRlt == null || dtblRlt.Rows.Count == 0) { continue; } foreach (DataRow drRlt in dtblRlt.Rows) { if (drRlt["term"].ToString().Contains("功耗")) { dr[drRlt["term"].ToString()] = "\t" + drRlt["result_data"].ToString() + " W " + (drRlt["result"].ToString() == "1" ? "通过" : "不通过"); } else if (drRlt["term"].ToString().Contains("HPLC")) { dr[drRlt["term"].ToString()] = "\t" + drRlt["result_data"].ToString() + " " + (drRlt["result"].ToString() == "1" ? "通过" : "不通过"); } else { dr[drRlt["term"].ToString()] = "\t" + drRlt["result_data"].ToString(); } } } catch (Exception ex) { MyLogLib.MyLog.WriteLog(ex); } } //taskNo = taskNo.Replace("\\", "").Replace("/", "").Replace(":", "").Replace("<", "").Replace(">", "").Replace("|", "").Replace("*", ""); SaveCSV(dtblCVS, AppDomain.CurrentDomain.BaseDirectory + @"history\" + taskNo + ".csv"); return; string sqlstring = "select test_result.id, scheme_name, result_data, date, test_operator, verify_operator, temperature, humidity, module_barcode, station_barcode, result, item from test_result, test_scheme where test_result.task_id = test_scheme.task_id"; List <String> returnList = new List <string> { }; DataTable dataTable = new DataTable(); dataTable.Columns.Add("行号", typeof(int)); dataTable.Columns.Add("方案名称", typeof(String)); dataTable.Columns.Add("结果数据", typeof(String)); dataTable.Columns.Add("日期", typeof(String)); dataTable.Columns.Add("检测人员", typeof(String)); dataTable.Columns.Add("核验人员", typeof(String)); dataTable.Columns.Add("温度", typeof(String)); dataTable.Columns.Add("湿度", typeof(String)); dataTable.Columns.Add("模块条码", typeof(String)); dataTable.Columns.Add("工装条码", typeof(String)); dataTable.Columns.Add("是否合格", typeof(String)); dataTable.Columns.Add("检测项", typeof(String)); returnList = MySQLHelper.SQLselect(sqlstring, 12); int i = 0; int k = 1; string yesorno = ""; while (returnList.Count != 0) { if (returnList[10 + i] == "2") { yesorno = "不合格"; } else { yesorno = "合格"; } dataTable.Rows.Add(k, returnList[1 + i], returnList[2 + i], returnList[3 + i], returnList[4 + i], returnList[5 + i], returnList[6 + i], returnList[7 + i], returnList[8 + i], returnList[9 + i], yesorno, returnList[11 + i]); i = i + 12; k++; if (returnList.Count == i) { break; } } SaveCSV(dataTable, AppDomain.CurrentDomain.BaseDirectory + @"history\history.csv"); }
private void SetCurrentWeapon(EquipModel weapon) { currentWeapon = weapon as WeaponModel; onWeaponSet.Invoke(currentWeapon); }
/// <summary> /// The set selected model async. /// </summary> /// <param name="value"> /// The value. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> private async Task SetSelectedModelAsync(EquipModel value) { bool canProceed = true; if (this.AssetModelDetail.IsCheckedOut && this.AssetModelDetail.IsChanged) { ConfirmationWindowView confirm = new ConfirmationWindowView(); ConfirmmationViewModel confirmViewModel = new ConfirmmationViewModel(); confirmViewModel.Content = "Changes have not been saved. Click OK to proceed without saving changes."; confirmViewModel.Title = "Confirm Save - Assets Model"; confirm.DataContext = confirmViewModel; confirm.ShowDialog(); if (confirm.DialogResult == false) { canProceed = false; } else { this.AssetModelDetail.IsChanged = false; } } if (canProceed) { this.ValidateNotError(); this.AssetModelDetail.IsChanged = false; this.AssetModelDetail.IsCheckedOut = false; this.SetEnableComboBox(false); if (value != null && !value.IsNewModel) { if (this.SelectedModel != null) { await this.UnLockAsync(); this.IsAdd = false; } } this.SetField(ref this._selectedModel, value, () => this.SelectedModel); this.AssetModelDetail.ResetSelectedComboBox(); if (this.SelectedModel != null) { this.AssetModelDetail.ModelDescription = this.SelectedModel.Description; this.AssetModelDetail.ModelEnabled = this.SelectedModel.Enabled; this.AssetModelDetail.ModelId = this.SelectedModel.EquipModelId; } if (value != null) { if (this.StepChanged != null) { this.StepChanged("DetailState"); await this.OnStepAsync(Asset.EnumSteps.SelectModel); } } this.Validate(); this.SelectedItem = this.SelectedModel; } }
/// <summary> /// Process actions or steps were raised on content /// </summary> /// <param name="e"> /// The e. /// </param> /// <param name="_params"> /// The _params. /// </param> /// <param name="item"> /// The id. /// </param> public void ProcessingStepsOnChild(EnumScreen e, object _params, object item) { Screen = e; // handle behavior for step on content EnumSteps currentStep = (EnumSteps)Enum.Parse(typeof(EnumSteps), _params.ToString()); object firstSelectedItem = null; if (FormBarMenuViewModel != null) { switch (currentStep) { case EnumSteps.Edit: case EnumSteps.Transfer: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; return; case EnumSteps.EditBulkUpdate: switch (Screen) { case EnumScreen.AssetCollateralClasses: case EnumScreen.AssetFeatures: var assetFeatureVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (assetFeatureVm != null) { assetFeatureVm.ChangedVisibilityHyperlink = Visibility.Hidden; } FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; return; } break; case EnumSteps.Cancel: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.CancelBulkUpdate: switch (Screen) { case EnumScreen.AssetCollateralClasses: case EnumScreen.AssetFeatures: var assetFeatureVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (assetFeatureVm != null) { assetFeatureVm.ChangedVisibilityHyperlink = Visibility.Hidden; } FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; } break; case EnumSteps.CancelAssignFeature: switch (Screen) { case EnumScreen.AssetCollateralClasses: FormBarMenuViewModel.FormMenuContent = "Asset Collateral Classes"; var assetFeatureVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (assetFeatureVm != null) { assetFeatureVm.ChangedVisibilityHyperlink = Visibility.Hidden; } FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumScreen.AssetFeatures: FormBarMenuViewModel.FormMenuContent = "Asset Features"; assetFeatureVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (assetFeatureVm != null) { assetFeatureVm.ChangedVisibilityHyperlink = Visibility.Hidden; } FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumScreen.AssetClassesCategory: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumScreen.AssetClassesType: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; } break; case EnumSteps.CancelAssignMake: switch (Screen) { case EnumScreen.AssetClassesType: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; } break; case EnumSteps.ItemLocked: if (item != null) { FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; switch (Screen) { case EnumScreen.CollectionAssignment: CollectionAssignmentModel selectedQueue = item as CollectionAssignmentModel; this.ToggleViewModel.SetSelectedItem(selectedQueue); break; } } return; case EnumSteps.Add: var toggleViewModel = this.ToggleViewModel.GridDynamicViewModel; if (toggleViewModel != null && toggleViewModel.SelectedItem != null) { toggleViewModel.SelectedItem = null; } if (Screen == EnumScreen.AssetClassesMake) { FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; } break; case EnumSteps.Delete: if (item != null) { switch (Screen) { case EnumScreen.AssetFeatures: this.ContentViewModel_OnPropertyChanged(currentStep, item); FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; } } var mainWindowDetailsViewModelFundingSummary = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (mainWindowDetailsViewModelFundingSummary != null) { mainWindowDetailsViewModelFundingSummary.ChangedVisibilityHyperlink = Visibility.Hidden; } FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; ContentViewModel_OnPropertyChanged(currentStep, item); return; case EnumSteps.Save: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; ContentViewModel_OnPropertyChanged(currentStep, item); return; //Asset classes Category step change for mode bulk update case EnumSteps.AssetClassesCategoryAssignFeaturesState: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Assign Features"; FormBarMenuViewModel.FormMenuContent = "Asset Category"; return; case EnumSteps.AssetClassesCategoryAssignTypesState: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Assign Types"; FormBarMenuViewModel.FormMenuContent = "Asset Category"; return; case EnumSteps.AssetClassesCategoryUpdateDepreciationState: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Update Depreciation"; FormBarMenuViewModel.FormMenuContent = "Asset Category"; return; //Asset classes Type step change for mode bulk update case EnumSteps.AssetClassesTypeAssignFeaturesState: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Assign Features"; FormBarMenuViewModel.FormMenuContent = "Asset Type"; return; case EnumSteps.AssetClassesTypeAssignMakeState: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Assign Make"; FormBarMenuViewModel.FormMenuContent = "Asset Type"; return; case EnumSteps.AssetClassesTypeUpdateDepreciationState: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Update Depreciation"; FormBarMenuViewModel.FormMenuContent = "Asset Type"; return; case EnumSteps.SaveAssignFeature: switch (Screen) { case EnumScreen.AssetCollateralClasses: case EnumScreen.AssetFeatures: var assetFeatureVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (assetFeatureVm != null) { assetFeatureVm.ChangedVisibilityHyperlink = Visibility.Hidden; } FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumScreen.AssetClassesCategory: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumScreen.AssetClassesType: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; } break; case EnumSteps.SaveAssignTypes: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; switch (Screen) { case EnumScreen.AssetCollateralClasses: var collateralVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (collateralVm != null) { collateralVm.ChangedVisibilityHyperlink = Visibility.Hidden; } return; } return; case EnumSteps.SaveAssignMake: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.SaveUpdateDepreciation: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.CancelAssignTypes: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.CancelUpdateDepreciation: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.BulkUpdate: switch (Screen) { case EnumScreen.AssetCollateralClasses: var collateralVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (collateralVm != null) { collateralVm.ChangedVisibilityHyperlink = Visibility.Hidden; } return; case EnumScreen.AssetFeatures: var assetFeatureVm = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (assetFeatureVm != null) { assetFeatureVm.ChangedVisibilityHyperlink = Visibility.Hidden; } return; } break; case EnumSteps.SelectOldTabHyperlink: return; //case EnumSteps.AssignModel: // if (Screen == EnumScreen.AssetClassesMake) // { // var assetMakeVm = this.ScreenDetailViewModel as MainAssetClassesViewModel; // if (assetMakeVm != null) // { // assetMakeVm.ChangedVisibility = Visibility.Collapsed; // } // return; // } // break; case EnumSteps.SaveAssignModel: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.AssignModel: FormBarMenuViewModel.ChangedVisibility = Visibility.Collapsed; FormBarMenuViewModel.FormBarContent = "Asset Make"; FormBarMenuViewModel.FormMenuContent = "Asset Make"; return; case EnumSteps.CancelAssignModel: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; return; case EnumSteps.SaveRegisterSummary: FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormBarContent = "Asset Registers"; FormBarMenuViewModel.FormMenuContent = "Menu"; return; //case EnumSteps.SelectRegisteredAsset: // FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; // FormBarMenuViewModel.FormBarContent = "Assets Detail"; // FormBarMenuViewModel.FormMenuContent = "Assets"; // return; } // handle behavior for screens when select item switch (Screen) { #region users case EnumScreen.Users: var mainWindowDetailsTabControlViewModel = this.ScreenDetailViewModel as MainWindowDetailsTabControlViewModel; if (mainWindowDetailsTabControlViewModel != null) { var usersViewModel = mainWindowDetailsTabControlViewModel.UsersMainWindowDetailsVm.ScreenDetailViewModel as UsersViewModel; if (usersViewModel != null) { if (usersViewModel.AllUsers != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var userCredentials = usersViewModel.AllUsers.Select(x => x.UserCredentials).ToList(); var userMappings = from d in userCredentials select new UserMapping { UserEntityId = d.UserEntityId, LoginName = d.LoginName, IsEnabled = d.IsEnabled, }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(UserMapping)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "LoginName", Header = "Login Name" }, new DynamicColumn { ColumnName = "IsEnabled", Header = "Enabled" }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = userMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "User List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = usersViewModel.SelectedUser; } } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Users"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Users") { FormBarMenuViewModel.FormBarContent = "User Detail"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region groups case EnumScreen.Groups: var mainWindowDetailsTabControlViewModel1 = this.ScreenDetailViewModel as MainWindowDetailsTabControlViewModel; if (mainWindowDetailsTabControlViewModel1 != null) { var groupsViewModel = mainWindowDetailsTabControlViewModel1.GroupsMainWindowDetailsVm.ScreenDetailViewModel as GroupsViewModel; if (groupsViewModel != null) { if (groupsViewModel.Groups != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var lxmGroup = groupsViewModel.Groups.Select(x => x.LXMGroup).ToList(); var groupMappings = from d in lxmGroup select new GroupMapping { UserEntityId = d.UserEntityId, GroupName = d.GroupName, }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(GroupMapping)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "GroupName", Header = "Group Name" } }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = groupMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Group List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = groupsViewModel.SelectedGroup; } } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Groups"; if (this._formGroupBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formGroupBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Groups") { FormBarMenuViewModel.FormBarContent = "Group Detail"; } else { FormBarMenuViewModel.FormBarContent = "Groups"; } } this._formGroupBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region collectionAssignment case EnumScreen.CollectionAssignment: var mainWindowDetailsViewModel = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (mainWindowDetailsViewModel != null) { var collectionAssignmentViewModel = mainWindowDetailsViewModel.ScreenDetailViewModel as CollectionsAssignmentViewModel; if (collectionAssignmentViewModel != null) { // load data for right hand grid var collectionAssignmentMappings = from d in collectionAssignmentViewModel.FilteredItems select new CollectionAssignmentMapping { QueueID = d.QueueID, FollowUpDate = d.FollowUpDate, ContractId = d.ContractId }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(CollectionAssignmentMapping)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "QueueID", Header = "Q#" }, new DynamicColumn { ColumnName = "FollowUpDate", Header = "Follow-Up", DataFormatString = "{0:g}" }, new DynamicColumn { ColumnName = "ContractId", Header = "Contract" }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = collectionAssignmentMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Assignment List"; this.ToggleViewModel.Screen = Screen; collectionAssignmentViewModel.SelectedItemChanged = this.ToggleViewModel.SetSelectedItem; firstSelectedItem = collectionAssignmentViewModel.SelectedQueue; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Assignments"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Assignments") { FormBarMenuViewModel.FormBarContent = "Assignment Detail"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region collectionQueues case EnumScreen.ColletionQueues: this.FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; this.FormBarMenuViewModel.FormMenuContent = "Menu"; var viewModel = this.ScreenDetailViewModel as MainWindowDetailsTabControlCollectionQueueViewModel; if (viewModel != null) { var list = viewModel.ListMainWindowDetailsVm.ScreenDetailViewModel as CollectionsManagementViewModel; if (list != null) { if (list.AllQueueManagementDetails != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var collectionQueue = list.AllQueueManagementDetails.Select(x => x.CollectionQueue) .OrderBy(c => c.AssignmentOrder) .ToList(); var collectionsManagementMappings = from d in collectionQueue select new CollectionsManagementMapping { Enabled = d.Enabled, ID = d.ID, QueueName = d.QueueName, AssignmentOrder = d.AssignmentOrder }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(CollectionsManagementMapping)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "Enabled", Header = "Enabled" }, new DynamicColumn { ColumnName = "AssignmentOrder", Header = "Order#" }, new DynamicColumn { ColumnName = "QueueName", Header = "Queue Name" }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = collectionsManagementMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Queue List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = list.SelectedQueue; } } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Queues"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Collection Queues") { FormBarMenuViewModel.FormBarContent = "Collection Queue Detail"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region fundingSummary case EnumScreen.FundingSummary: var mainWindowDetailsViewModelFundingSummary = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (mainWindowDetailsViewModelFundingSummary != null) { var fundingSummaryViewModel = mainWindowDetailsViewModelFundingSummary.ScreenDetailViewModel as FundingSummaryViewModel; if (fundingSummaryViewModel != null) { if (fundingSummaryViewModel.TrancheSummary != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var fundingSummaryMappings = from d in fundingSummaryViewModel.TrancheSummary select new FundingSummaryMaping { TrancheId = d.TrancheId, FunderName = d.FunderName, }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(FundingSummaryMaping)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "FunderName", Header = "Funder Name" }, new DynamicColumn { ColumnName = "TrancheId", Header = "Tranche ID" }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = fundingSummaryMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Tranche List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = fundingSummaryViewModel.SelectedTranche; } } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Tranches"; FormBarMenuViewModel.FormBarContent = "Funding Detail"; this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region asset classes category case EnumScreen.AssetClassesCategory: var mainDetailModel = this.ScreenDetailViewModel as MainAssetClassesViewModel; if (mainDetailModel != null) { var assetClassesCategoryViewModel = mainDetailModel.AssetCategoryViewModel.ScreenDetailViewModel as AssetClassesCategoryViewModel; if (assetClassesCategoryViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetClassesCategoryRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName="Category",Header="CATEGORY NAME", MinWidth = 90}, new DynamicColumn { ColumnName="Enabled",Header="ENABLED", MinWidth = 80, ColumnTemplate = RadGridViewEnum.ColumnCheckedTemplate }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetClassesCategoryViewModel.ListDataGridItem.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Asset Category List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = new EquipCategory { EquipCatId = assetClassesCategoryViewModel.SelectedCategoryItem.EquipCategoryId }; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Category"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Features") { FormBarMenuViewModel.FormBarContent = "Asset Features"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region asset classes type case EnumScreen.AssetClassesType: var mainDetailModelType = this.ScreenDetailViewModel as MainAssetClassesViewModel; if (mainDetailModelType != null) { var assetClassesTypeViewModel = mainDetailModelType.AssetClassesTypeViewModel.ScreenDetailViewModel as AssetClassesTypeViewModel; if (assetClassesTypeViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetClassesTypeRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName="TypeDescription",Header="TYPE", MinWidth = 65 }, new DynamicColumn { ColumnName="Enabled",Header="ENABLED", MinWidth= 80, ColumnTemplate = RadGridViewEnum.ColumnCheckedTemplate }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetClassesTypeViewModel.ListDataGridItem.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Asset Type List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = new EquipType { EquipTypeId = assetClassesTypeViewModel.SelectedTypeItem.EquipTypeId }; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Type"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Type") { FormBarMenuViewModel.FormBarContent = "Asset Type"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region asset feature case EnumScreen.AssetFeatures: var model = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (model != null) { var assetFeaturesViewModel = model.ScreenDetailViewModel as AssetFeaturesViewModel; if (assetFeaturesViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var assetFeaturesMappings = from d in assetFeaturesViewModel.AllFeatureTypes select new AssetFeatureTypeRowItem { FeatureTypeId = d.FeatureTypeId, FeatureName = d.FeatureName, Enabled = d.Enabled, }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetFeatureTypeRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "FeatureName", Header = "FEATURE NAME", MinWidth= 80 }, new DynamicColumn { ColumnName = "Enabled", Header ="ENABLED", MinWidth = 80, ColumnTemplate = RadGridViewEnum.ColumnCheckedTemplate }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetFeaturesMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Feature List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = assetFeaturesViewModel.SelectedFeatureType; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Features"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Features") { FormBarMenuViewModel.FormBarContent = "Asset Features"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region Asset Classes Model case EnumScreen.AssetClassesModel: var mainWindowDetailsModel = this.ScreenDetailViewModel as MainAssetClassesViewModel; if (mainWindowDetailsModel != null) { var assetClassesModelViewModel = mainWindowDetailsModel.AssetClassesModelViewModel.ScreenDetailViewModel as AssetClassesModelViewModel; if (assetClassesModelViewModel != null) { if ((this.ToggleViewModel.GridDynamicViewModel == null) || (this.ToggleViewModel.Screen != Screen)) { var assetModelMappings = from d in assetClassesModelViewModel.AllAssetModel select new AssetClassesModelRowItem { EquipModelId = d.EquipModelId, Description = d.Description, Enabled = d.Enabled }; this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetClassesModelRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "Description", Header = "MODEL", MinWidth = 70 }, new DynamicColumn { ColumnName = "Enabled", Header = "ENABLED", MinWidth = 80, ColumnTemplate = RadGridViewEnum.ColumnCheckedTemplate } }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetClassesModelViewModel.AllAssetModel.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Model List"; this.ToggleViewModel.Screen = Screen; } //firstSelectedItem = assetClassesModelViewModel.SelectedModel; firstSelectedItem = new EquipModel() { EquipModelId = assetClassesModelViewModel.SelectedModel.EquipModelId, }; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Model"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Model") { FormBarMenuViewModel.FormBarContent = "Asset Model"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region asset classes make type case EnumScreen.AssetClassesMake: var mainDetailModelAsset = this.ScreenDetailViewModel as MainAssetClassesViewModel; if (mainDetailModelAsset != null) { var assetClassesMakeViewModel = mainDetailModelAsset.AssetClassesMakeViewModel.ScreenDetailViewModel as AssetClassesMakeViewModel; if (assetClassesMakeViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { //var assetClassesCategoryMappings = from itemCategory in (assetClassesCategoryViewModel.CategoryDetailViewModel.DynamicAssetClassCategoryViewModel.GridDataRows) // select // new AssetClassesCategoryRowItem // { // Category = (itemCategory as AssetClassesCategoryRowItem).Category, // Enabled = (itemCategory as AssetClassesCategoryRowItem).Enabled, // }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetClassesMakeRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "Description", Header = "MAKE", MinWidth = 70 }, new DynamicColumn { ColumnName = "Enabled", Header = "ENABLED", MinWidth = 80, ColumnTemplate = RadGridViewEnum.ColumnCheckedTemplate }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetClassesMakeViewModel.AllAssetMake.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Make List"; this.ToggleViewModel.Screen = Screen; } //firstSelectedItem = assetClassesMakeViewModel.DynamicAssetClassMakeViewModel.SelectedItem; firstSelectedItem = new EquipMake() { EquipMakeId = assetClassesMakeViewModel.SelectedMake.EquipMakeId }; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Make"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Make") { FormBarMenuViewModel.FormBarContent = "Asset Make"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid if (currentStep == EnumSteps.AssignModel) { ChangedVisibility = Visibility.Collapsed; } else { ChangedVisibility = Visibility.Visible; } break; #endregion #region asset collateral classes case EnumScreen.AssetCollateralClasses: var viewmodel = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (viewmodel != null) { var assetCollateralViewModel = viewmodel.ScreenDetailViewModel as AssetCollateralClassesViewModel; if (assetCollateralViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var assetFeaturesMappings = assetCollateralViewModel.AllCollateralClasses; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetCollateralRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "Description", Header = "COLLATERAL CLASS", MinWidth= 95 }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetFeaturesMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Collateral Class List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = assetCollateralViewModel.SelectedCollateral; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Collateral Classes"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Collateral Classes") { FormBarMenuViewModel.FormBarContent = "Asset Collateral Classes"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region registers case EnumScreen.AssetRegisters: var mainWindowDetailsViewModelRegister = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (mainWindowDetailsViewModelRegister != null) { var registersViewModel = mainWindowDetailsViewModelRegister.ScreenDetailViewModel as AssetRegistersViewModel; if (registersViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var assetRegistersMappings = from d in registersViewModel.AllAssetRegister select new AssetRegisterRowItem { ID = d.ID, RegisterName = d.RegisterName, ReportName = d.ReportName, InternalOnly = d.InternalOnly }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(AssetRegisterRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "RegisterName", Header = "REGISTER NAME", MinWidth = 90 }, new DynamicColumn { ColumnName = "InternalOnly", Header = "INTERNAL ONLY", MinWidth = 90, ColumnTemplate = RadGridViewEnum.ColumnCheckedTemplate }, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetRegistersMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Asset Register"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = new AssetRegister() { ID = registersViewModel.SelectedRegister.ID }; //firstSelectedItem = registersViewModel.SelectedRegister; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Asset Register"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Asset Registers") { FormBarMenuViewModel.FormBarContent = "Asset Registers Detail"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion #region registeredAsset case EnumScreen.RegisteredAsset: var mainWindowDetailsViewModelRegisteredAsset = this.ScreenDetailViewModel as MainWindowDetailsViewModel; if (mainWindowDetailsViewModelRegisteredAsset != null) { var registersViewModel = mainWindowDetailsViewModelRegisteredAsset.ScreenDetailViewModel as RegisteredAssetViewModel; if (registersViewModel != null) { // load data for right hand grid if (this.ToggleViewModel.GridDynamicViewModel == null || this.ToggleViewModel.Screen != Screen) { var assetRegistersMappings = from d in registersViewModel.AllRegisteredAsset select new RegisteredAssetRowItem() { Id = d.Id, AssetRegisterId = d.AssetRegisterId, AssetState = d.AssetState, }; // create column and data for dynamic grid this.ToggleViewModel.GridDynamicViewModel = null; this.ToggleViewModel.GridDynamicViewModel = new DynamicGridViewModel(typeof(RegisteredAssetRowItem)); this.ToggleViewModel.GridDynamicViewModel.GridColumns = new List<DynamicColumn> { new DynamicColumn { ColumnName = "Id", Header = "Asset ID" }, new DynamicColumn { ColumnName = "AssetRegisterId", Header = "Reg#" }, new DynamicColumn { ColumnName = "AssetState", Header = "Asset State"}, }; this.ToggleViewModel.GridDynamicViewModel.GridDataRows = assetRegistersMappings.ToList<object>(); this.ToggleViewModel.GridDynamicViewModel.LoadRadGridView(); this.ToggleViewModel.Header = "Assets List"; this.ToggleViewModel.Screen = Screen; } firstSelectedItem = new RegisteredAsset { ID = registersViewModel.SelectedRegistererdAsset.Id }; //firstSelectedItem = registersViewModel.SelectedRegister; } } // change behavior form bar menu FormBarMenuViewModel.ChangedVisibility = Visibility.Visible; FormBarMenuViewModel.FormMenuContent = "Assets"; if (this._formBarCurrent != string.Empty) { FormBarMenuViewModel.FormBarContent = this._formBarCurrent; } else { if (FormBarMenuViewModel.FormBarContent == "Assets") { FormBarMenuViewModel.FormBarContent = "Asset Detail"; } } this._formBarCurrent = FormBarMenuViewModel.FormBarContent; // Visible right hand grid ChangedVisibility = Visibility.Visible; break; #endregion } } // To call some Actions or Events of Toggle ViewModel if (ToggleViewModel != null) { ToggleViewModel.OnSelectedItemChange = ToggleViewModel_SelectedItemChanged; ToggleViewModel.RaiseSelectedItemChanged(); if (firstSelectedItem != null) { ToggleViewModel.SetSelectedItem(firstSelectedItem); } } }