Пример #1
0
 public void DeleteBoard(dynamic json)
 {
     var db = new CalculationDBContext();
     ProjectBoard ProjectBoard = db.ProjectBoard.Find(Convert.ToInt32(json.boardId));
     db.ProjectBoard.Remove(ProjectBoard);
     db.SaveChanges();
 }
        public HttpResponseMessage MoveStory(JObject moveTaskParams)
        {
            dynamic json = moveTaskParams;
            var repo = new ColumnRepository();
            CalculationDBContext db = new CalculationDBContext();
            var response = Request.CreateResponse();

            if (json.updateType == "Add")
            {
                repo.AddStory((int)json.targetColId);
            }
            else if (json.updateType == "Delete")
            {
                repo.DeleteStory((int)json.storyId, (int)json.targetColId);
            }
            else if (json.updateType == "Edit")
            {
                repo.EditStory((int)json.storyId, (int)json.targetColId, json.data);
            }
            else
            {
                //repo.MoveStory((int)json.storyId, (int)json.targetColId);
            }

            response.StatusCode = HttpStatusCode.OK;

            return response;
        }
        public void CalculationRegressionAdd(string InputXML, string OutputXML, string CalcReference, string Scheme, string CalcType, Boolean Run)
        {
            CalculationRegression CalcRegression = new CalculationRegression();

            string OldOutput = "";
            int resultid = 0;
            using (var context = new CalculationDBContext())
            {
                var Regression = context.CalculationRegression
                .Where(b => b.Reference == CalcReference && b.Scheme == Scheme && b.Type == CalcType)
                .FirstOrDefault();

                if (Regression == null)
                {
                    resultid = 0;
                }
                else
                {
                    OldOutput = Regression.OutputOld;
                    resultid = Regression.Id;
                }

            }

            if (Run == true)
            {
                XMLFunctions XMLFunction = new XMLFunctions();

                string Difference = XMLFunction.MatchXML(OldOutput, OutputXML);
                CalcRegression.OutputNew = OutputXML;
                CalcRegression.LatestRunDate = DateTime.Now;
                CalcRegression.Difference = Difference;

                if (Difference == null)
                {
                    CalcRegression.Pass = "******";
                }
                else
                {
                    CalcRegression.Pass = "******";
                }
            }
            else
            {
                CalcRegression.Scheme = Scheme;
                CalcRegression.Type = CalcType;
                CalcRegression.Input = InputXML;
                CalcRegression.OutputOld = OutputXML;
                CalcRegression.Reference = CalcReference;
                CalcRegression.OriginalRunDate = DateTime.Now;
                CalcRegression.LatestRunDate = DateTime.Now;
            }

            if (resultid > 0)
            {
                CalcRegression.Id = resultid;
                EditCalcRegression(CalcRegression, Run);
            }
            else
            {
                CreateCalcRegression(CalcRegression);
            }
        }