public IHttpActionResult CreatePlanAdd(PlanAddDto planAdd)
        {
            JsonObject      json         = new JsonObject();
            GradeVersionDAL gradeVersion = new GradeVersionDAL();
            string          version      = gradeVersion.CheckGradeVersion(planAdd.SampleName, planAdd.LOT_NO);

            if (string.IsNullOrEmpty(version))
            {
                json["Error"] = "Grade Version is NULL";
                return(Ok(json));
            }
            planAdd.GradeVersion = new Guid(version);

            try
            {
                DOCPlanAdd sd = JsonConvert.DeserializeObject <DOCPlanAdd>(JsonConvert.SerializeObject(planAdd));;
                if (!draftDAL.CreatePlanAdd(sd))
                {
                    json["Error"] = "Can not Save Plan Add";
                    return(Ok(json));
                }
                else
                {
                    json["Success"] = "Success";
                    return(Ok(json));
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
                Loger.Error(ex);
                return(BadRequest(ex.Message + "-" + ex.StackTrace));
            }
        }
        /// <summary>
        ///  add Plan project  Create
        /// </summary>
        /// <param name="DOC"></param>
        /// <returns></returns>
        public bool InsertPlanAdd(DOCPlanAdd DOC)
        {
            Console.WriteLine("PlanAddService-InsertPlanAdd():" + DateTime.Now);
            //Get Currrent User

            try
            {
                DataTable dt = acQC.ExecuteStoredProcedure("i_CheckGrade_Version",
                                                           new string[] { "UserID", "SampleName", "LOT_NO" },
                                                           new object[] { "", DOC.SampleName, DOC.LOT_NO }).Tables[0];
                string msg = string.Empty;
                msg = dt.Rows[0]["MSG"].ToString();
                if (!string.IsNullOrEmpty(msg))
                {
                    throw new Exception(msg);
                }
                DOC.GradeVersion = new Guid(dt.Rows[0]["VersionID"].ToString());
                DOC.ProdDate     = System.DateTime.Now;
                DOC.State        = "0";
                DOC.UserID       = DB.User;
                log.Info(JsonConvert.SerializeObject(DOC));
                return(db.Insert(DOC));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw e;
            }
        }
        /// <summary>
        /// create plan ,other add test project
        /// </summary>
        /// <param name="planAdd"></param>
        /// <returns></returns>
        public bool CreatePlanAdd(DOCPlanAdd planAdd)
        {
            try
            {
                return(db.Insert(planAdd));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
Exemplo n.º 4
0
        public bool CreatePlanAdd(DOCPlanAdd planadd)
        {
            Console.WriteLine("PlanAddDAL - CreatePlanAdd():" + DateTime.Now.ToString());
            try
            {
                return(db.Insert(planadd));
            }
            catch (Exception e)
            {
                log.Error(e);

                throw new Exception(e.Message);
            }
        }
 public bool InsertPlanAdd(DOCPlanAdd DOC)
 {
     return(proxy.InsertPlanAdd(DOC));
 }