Example #1
0
        public bool UpdateRecipe(Recipes rcp, CameraRecipe camrcp, ScanRecipe scanrcp, ControlRecipe ctrlrcp)
        {
            bool rect = false;

            try
            {
                RecipesDao dao = new RecipesDao();
                rect = dao.Update(rcp);
                CameraRecipeDao camdao = new CameraRecipeDao();
                if (camdao.GetCameraRecipe(rcp.RecipeId) == null)
                {
                    rect = camdao.Insert(camrcp);
                }
                else
                {
                    rect = camdao.Update(camrcp);
                }
                ScanRecipeDao scandao = new ScanRecipeDao();
                if (scandao.GetScanRecipe(rcp.RecipeId) == null)
                {
                    rect = scandao.Insert(scanrcp);
                }
                else
                {
                    rect = scandao.Update(scanrcp);
                }
                ControlRecipeDao ctrldao = new ControlRecipeDao();
                if (ctrldao.GetControlRecipe(ctrlrcp.RecipeId) == null)
                {
                    rect = ctrldao.Insert(ctrlrcp);
                }
                else
                {
                    rect = ctrldao.Update(ctrlrcp);
                }
            }
            catch (Exception ex)
            {
                LogHelper.AppLoger.Error(ex);
            }
            return(rect);
        }
Example #2
0
 public void LoadRcp(int rcp_id)
 {
     try
     {
         RecipesDao dao = new RecipesDao();
         _curRcp = dao.GetRecipe(rcp_id);
         CameraRecipeDao camdao = new CameraRecipeDao();
         _curCameraRcp = camdao.GetCameraRecipe(rcp_id);
         ScanRecipeDao scandao = new ScanRecipeDao();
         _curScanRcp = scandao.GetScanRecipe(rcp_id);
         ControlRecipeDao ctrldao = new ControlRecipeDao();
         _curControlRcp = ctrldao.GetControlRecipe(rcp_id);
         RecipeId       = _curRcp.RecipeId;
         RecipeName     = _curRcp.Name;
         IsChangeRcp    = true;
     }
     catch (Exception ex)
     {
         LogHelper.AppLoger.Error(ex);
     }
 }