private bool Update(ApplyContainerInfo info) { ArrayList al = new ArrayList(); al.Add(info.ModuleID); al.Add(info.ApplyContainerID); al.Add(info.fleetSetting_ContainerID); al.Add(info.AlarmRuleSetID); al.Add(info.PortNameInDB); al.Add(info.BranchID); al.Add(info.BranchCode); al.Add(info.UpdateBy); al.Add(info.UpdateByName); al.Add(info.UpdateStamp); al.Add(info.StatusCode); DataProvider.Instance().Update_ApplyContainer(al); return true; }
private bool Insert(ApplyContainerInfo info) { if (string.IsNullOrEmpty(info.ApplyContainerID)) { info.ApplyContainerID = _docCtrl.GetNextDocNumber("FMS_ApplyContainerID", DocumentController.DocNumberStatus.Reserve); info.BranchID = _branchCtrl.GetNextBranchID(); info.BranchCode = _branchCtrl.GetInitialBranchCode; } ArrayList al = new ArrayList(); al.Add(info.ModuleID); al.Add(info.ApplyContainerID); al.Add(info.fleetSetting_ContainerID); al.Add(info.AlarmRuleSetID); al.Add(info.PortNameInDB); al.Add(info.RevokeID); al.Add(info.BranchID); al.Add(info.BranchCode); al.Add(info.CreateBy); al.Add(info.CreateByName); al.Add(info.CreateStamp); al.Add(info.UpdateBy); al.Add(info.UpdateByName); al.Add(info.UpdateStamp); al.Add(info.StatusCode); DataProvider.Instance().Insert_ApplyContainer(al); ModuleController.SynchronizeModule(info.ModuleID); return true; }
private void Done(bool saveLog, BranchInfo.BranchType branchType) { if (ProcessFlowReturn.Equals("False")) Info.StatusCode = "RELEASE"; else { if (PageMode.Mode.CREATE.Equals(PM)) Info.StatusCode = "DRAFT"; } // Start User Define Parameter For SaveData Info.RuleName = txtRuleName.Text; Info.AlarmType = ddlAlarmType.SelectedValue; //Info.AlarmType = hidAlarmType.Value; //Info.AlarmTypeName = hidAlarmTypeName.Value; Info.Severity = ddlSeverity.SelectedValue; Info.CustomCode = ""; //txtCustomCode.Text; Info.Notifier = ""; foreach (ListItem itm in chklNotifier.Items) { if (itm.Selected) { if (Info.Notifier != "") Info.Notifier = Info.Notifier + ","; Info.Notifier = Info.Notifier + itm.Value; } } Info.State = ddlState.SelectedValue; Info.GenerateTask = rdlGenerateTask.SelectedValue; Info.Handler = rdlHandler.SelectedValue; Info.Rules = hidRules.Value; // End User Define Parameter For SaveData _ctrl.Save(Info, PM, saveLog, branchType); bool isTemperature = false; if(Info.AlarmType.CompareTo("611") == 0) isTemperature = true; //ApplyCar string[] ary = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(hidApplyCarList.Value); ApplyCarController applyCarController = new ApplyCarController(); ApplyCarInfo applyCarInfo = null; applyCarController.DeleteByAlarmRuleSet(Info.AlarmRuleSetID); Dictionary<string, string> dic; if (isTemperature) { dic = new Dictionary<string, string>(); for (int i = 0; i < ary.Length; i++) { string[] splitArray = ary[i].Split(';'); string value; if (dic.TryGetValue(splitArray[0], out value)) //相同carInfoId的資料合併 { value = value + '|' + splitArray[1]; } else { value = splitArray[1]; } dic[splitArray[0]] = value; } foreach (KeyValuePair<string, string> kv in dic) { applyCarInfo = new ApplyCarInfo(); InitialObject(applyCarInfo, RequestModuleID); applyCarInfo.AlarmRuleSetID = Info.AlarmRuleSetID; applyCarInfo.fleetSetting_CARInfoID = kv.Key; applyCarInfo.PortNameInDB = kv.Value; applyCarController.Save(applyCarInfo, PageMode.Mode.CREATE, saveLog, branchType); } } else { for (int i = 0; i < ary.Length; i++) { applyCarInfo = new ApplyCarInfo(); InitialObject(applyCarInfo, RequestModuleID); applyCarInfo.AlarmRuleSetID = Info.AlarmRuleSetID; applyCarInfo.fleetSetting_CARInfoID = ary[i]; applyCarController.Save(applyCarInfo, PageMode.Mode.CREATE, saveLog, branchType); } } //ApplyContainer string[] ary2 = Newtonsoft.Json.JsonConvert.DeserializeObject<string[]>(hidApplyContainerList.Value); ApplyContainerController applyContainerController = new ApplyContainerController(); ApplyContainerInfo applyContainerInfo = null; applyContainerController.DeleteByAlarmRuleSet(Info.AlarmRuleSetID); if (isTemperature) { dic = new Dictionary<string, string>(); for (int i = 0; i < ary2.Length; i++) { string[] splitArray = ary2[i].Split(';'); string value; if (dic.TryGetValue(splitArray[0], out value)) //相同carInfoId的資料合併 { value = value + '|' + splitArray[1]; } else { value = splitArray[1]; } dic[splitArray[0]] = value; } foreach (KeyValuePair<string, string> kv in dic) { applyContainerInfo = new ApplyContainerInfo(); InitialObject(applyContainerInfo, RequestModuleID); applyContainerInfo.AlarmRuleSetID = Info.AlarmRuleSetID; applyContainerInfo.fleetSetting_ContainerID = kv.Key; applyContainerInfo.PortNameInDB = kv.Value; applyContainerController.Save(applyContainerInfo, PageMode.Mode.CREATE, saveLog, branchType); } } else { for (int i = 0; i < ary2.Length; i++) { applyContainerInfo = new ApplyContainerInfo(); InitialObject(applyContainerInfo, RequestModuleID); applyContainerInfo.AlarmRuleSetID = Info.AlarmRuleSetID; applyContainerInfo.fleetSetting_ContainerID = ary2[i]; applyContainerController.Save(applyContainerInfo, PageMode.Mode.CREATE, saveLog, branchType); } } Hashtable ht = new Hashtable(); ht.Add("ModID", this.ModuleId); ht.Add("DocID", Info.AlarmRuleSetID); ModuleCommunicationEventArgs mcArgs = new ModuleCommunicationEventArgs(); mcArgs.Sender = this.IMC_Sender; mcArgs.Target = IMC.SaveSupportComponentTarget; mcArgs.Type = "System.Collections.Hashtable"; mcArgs.Value = ht; mcArgs.Text = ""; ModuleCommunication(this, mcArgs); }