Ejemplo n.º 1
0
 public bool SaveParameter(out String Msg)
 {
     lock (ResManager.ui_lockObj)
     {
         Msg = "";
         if (!DataGridUtil.GetDataGridRowsHasError(dg))
         {
             var result = bjService.SaveBJ(BJObjList);
             if (!result)
             {
                 Msg = "保存失败!";
             }
             else
             {
                 IList <VBJ> tem = null;
                 if (Constants.BJDict.ContainsKey(T.Name))
                 {
                     tem = Constants.BJDict[T.Name];
                     Constants.BJDict.Remove(T.Name);
                 }
                 Constants.BJDict.Add(T.Name, bjService.QueryBJ(T.Name));
                 var rlist = Constants.BJDict[T.Name];
                 if (tem != null && rlist.Count == tem.Count)
                 {
                     for (int i = 0; i < rlist.Count; i++)
                     {
                         rlist[i].ChangedValueMap = tem[i].ChangedValueMap;
                         rlist[i].CopyValues(tem[i].Values);
                     }
                 }
                 Engine.getInstance().InitRes();
             }
             return(result);
         }
         else
         {
             Msg = "请检查数据";
             return(false);
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// 确定 按钮
        /// </summary>
        /// <param name="dg"></param>
        public void ClickOK(DataGrid dg)
        {
            if (DataGridUtil.GetDataGridRowsHasError(dg))
            {
                SwitchTab(1);
                this.View.UpdateLayout();
                //windowManager.ShowMessageBox("请详细检查数据");
                dg.ShowHint(new MessageWin("请详细检查数据"));
                return;
            }
            SyncTubeName();
            SyncStep();
            unknown.Refresh();
            t_Gel.UnknownResult = unknown.ToString();

            var lastgel_list = gelService.QueryGelStepByGelId(t_Gel.ID);

            foreach (var lastgel in lastgel_list)
            {
                bool is_find = false;
                foreach (var gelstep in GelSteps)
                {
                    if (lastgel.ID == gelstep.ID)
                    {
                        is_find = true;
                        break;
                    }
                }
                if (is_find == false)
                {
                    gelService.DeleteGelStep(lastgel);
                }
            }

            var lastgelres_list = gelService.QueryResMapByGelId(t_Gel.ID);

            foreach (var lastresgel in lastgelres_list)
            {
                bool is_find = false;
                foreach (var resmap in t_Gel.ResultMaps)
                {
                    if (lastresgel.ID == resmap.ID)
                    {
                        is_find = true;
                        break;
                    }
                }
                if (is_find == false)
                {
                    gelService.DeleteGelResutMap(lastresgel);
                }
            }

            //按顺序排列setps
            for (int i = 0; i < t_Gel.GelSteps.Count; i++)
            {
                t_Gel.GelSteps[i].StepIndex = i;
            }
            if (gelService.InserOrUpdateGEL(t_Gel))
            {
                Engine.getInstance().InitRes();
                windowManager.ShowMessageBox("保存成功!");
            }
            else
            {
                windowManager.ShowMessageBox("保存失败!");
            }
        }