Ejemplo n.º 1
0
        /// <summary> 重新加载 </summary>
        public void RefreshLoad(CaseModel model)
        {
            var collection = DirectoryHelper.GetAllFile(model.CasePath);

            var models = model.ListJson.SerializeDeJson <List <MovieFileModel> >();


            // Todo :增加内存数据
            foreach (var item in collection)
            {
                if (!this.MatchFile(item))
                {
                    continue;
                }

                var result = models.Find(l => l.FilePath == item);

                if (result != null)
                {
                    continue;
                }

                MovieFileModel m = new MovieFileModel(item);
                models.Add(m);
            }


            // Todo :删除无效数据
            models.RemoveAll(l => !File.Exists(l.FilePath));

            model.ListJson = models.SerializeJson <List <MovieFileModel> >();

            this.CreateCase(model);
        }
        public void GivenTheSameCaseExistsInBlaiseWithTheOutcomeCode(int outcomeCode)
        {
            var primaryKey = _scenarioContext.Get <string>("primaryKey");
            var caseModel  = new CaseModel(primaryKey, outcomeCode.ToString(), ModeType.Tel, DateTime.Now.AddHours(-2));

            CaseHelper.GetInstance().CreateCaseInBlaise(caseModel);
        }
Ejemplo n.º 3
0
 public Test_Linq()
 {
     NameSign = @"学习-Linq";
     SonCases = new CaseModel[] {
         Func_ListArray(),
     };
 }
Ejemplo n.º 4
0
 private void AfterGetQueryModel_Extend(CaseModel caseModel)
 {
     caseModel.Case.Columns.GetObjectByItem("ShipQty").DisplayName    = "本次出运数量";
     caseModel.Case.Columns.GetObjectByItem("ShipQty").ItemCaption    = "本次出运数量";
     caseModel.Case.Columns.GetObjectByItem("ShipCanQty").DisplayName = "本次可出运数量";
     caseModel.Case.Columns.GetObjectByItem("ShipCanQty").ItemCaption = "本次可出运数量";
 }
Ejemplo n.º 5
0
        public FileContentResult DownloadLink(string id)
        {
            Guid   guid          = new Guid(id);
            String stringGuid    = guid.ToString("D");
            Guid   formattedGuid = new Guid(stringGuid);

            CaseModel caseModel = client.GetCase(guid);

            if (caseModel.Status == CaseStatus.Sent)
            {
                var filnavn = DBController.HentDokument(id).Filnavn;

                var         receipt     = caseModel.Documents.Where(d => d.Type == DocumentType.Original).Single();
                List <byte> fileContent = new List <byte>();
                byte[]      returnedFile;

                using (Stream stream = client.GetDocumentData(formattedGuid, receipt.Id))
                {
                    StreamReader reader  = new StreamReader(stream);
                    string       payload = reader.ReadToEnd();
                    returnedFile = System.Text.Encoding.UTF8.GetBytes(payload);
                }
                //byte[] returnedFile2 = new byte[fileContent.Count()];
                //fileContent.CopyTo(returnedFile2);
                return(File(returnedFile, System.Net.Mime.MediaTypeNames.Application.Pdf, filnavn));
            }

            return(null);
        }
Ejemplo n.º 6
0
 public Test_WebSite()
 {
     NameSign = @"Web站点";
     SonCases = new CaseModel[] {
         Func_MatchSiteName(),
     };
 }
        public ActionResult GetClientInfo(Cases model)
        {
            if (ModelState.IsValid)
            {
                var context = new ApplicationDbContext();
                var cm      = new CaseModel
                {
                    ActSignature = model.Case.ActSignature,
                    Type         = model.Case.Type,
                    Price        = model.Case.Price,
                    Instance     = model.Case.Instance,
                    UserId       = model.personelModel.Id
                };
                context.Cases.Add(cm);
                context.SaveChanges();

                model.CasesList.Clear();
                var userId = model.personelModel.Id;
                model.Case.Instance     = "";
                model.Case.PriceAll     = "";
                model.Case.Type         = "";
                model.Case.ActSignature = "";
                return(View(model));
            }
            else
            {
                return(View(model));
            }
        }
Ejemplo n.º 8
0
 public Test_XML()
 {
     NameSign = @"XML文件";
     SonCases = new CaseModel[] {
         Func_XmlSerializer(),
     };
 }
Ejemplo n.º 9
0
        public HttpResponseMessage SaveCase(CaseModel caso)
        {
            string nombreCaso = caso.CaseName;
            string comercial  = caso.Comercial;
            string tipoPagos  = caso.Pagos;
            string integrador = caso.Integrador;

            var client = new HttpClient();

            //Creacion Card
            try
            {
                dynamic body    = new System.Dynamic.ExpandoObject();
                var     content = new StringContent(JsonConvert.SerializeObject(body), Encoding.UTF8, "application/json");
                content.Headers.ContentType = new MediaTypeHeaderValue("application/json");
                string description = "Comercial:" + comercial + "---" + "Integrador:" + integrador;
                string uri         = "https://api.trello.com/1/cards?idMembers=59c2f251c929d5e77a2f37da&name=" + nombreCaso + "&desc=" + description + "&idList=5b9a6ceeb8076b37908695d4&keepFromSource=all&key=a9f027bba71c5ed49727bf65b25b6b93&token=47282984b2d62a89240b9742f94a5d9a050d3ad1d1b42a1db3a397a9ad85cc0d";
                Task.Factory.StartNew(async() =>
                {
                    HttpResponseMessage response = await client.PostAsync(uri, content);
                    string respuestaDe           = await response.Content.ReadAsStringAsync();
                    dynamic respuesta            = JsonConvert.DeserializeObject(respuestaDe);
                    string id           = respuesta.id;
                    string uriChecklist = "https://api.trello.com/1/cards/" + id + "/checklists?key=a9f027bba71c5ed49727bf65b25b6b93&token=47282984b2d62a89240b9742f94a5d9a050d3ad1d1b42a1db3a397a9ad85cc0d";
                    HttpResponseMessage responseChecklist = await client.PostAsync(uriChecklist, content);
                });
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            return(Request.CreateResponse(HttpStatusCode.OK));
        }
Ejemplo n.º 10
0
        public List <CaseRepo> GetCases()
        {
            List <CaseRepo> cases = new List <CaseRepo>();

            string sqlString = "SELECT* FROM ViewCases";

            PrepareSql(sqlString);
            SqlDataReader reader = null;

            reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    CaseModel c1 = new CaseModel();
                    c1.Id     = reader["ID"] != DBNull.Value ? Convert.ToInt32(reader["ID"]) : default(int);
                    c1.Name   = reader["CaseName"] != DBNull.Value ? reader["CaseName"].ToString() : String.Empty;
                    c1.Client = $"{(reader["ClientfName"] != DBNull.Value ? reader["ClientfName"].ToString() : string.Empty)} " +
                                $"{(reader["ClientlName"] != DBNull.Value ? reader["ClientlName"].ToString() : string.Empty)}";

                    c1.RespEmployee = $"{(reader["EmployeefName"] != DBNull.Value ? reader["EmployeefName"].ToString() : string.Empty)} " +
                                      $"{(reader["EmployeelName"] != DBNull.Value ? reader["EmployeelName"].ToString() : string.Empty)}";

                    cases.Add(c1);
                }
            }
            connection.Close();
            return(cases);
        }
Ejemplo n.º 11
0
        private int mLastSelectNo      = 0;             // Remember the last selected index

        public CaseModel caseInitialise()
        {
            CaseModel caseInfo = new CaseModel();

            caseInfo.TicketNo     = string.Empty;
            caseInfo.OffenceSet   = -1;
            caseInfo.Notification = string.Empty;
            caseInfo.Image1       = string.Empty;
            caseInfo.Image2       = string.Empty;
            caseInfo.RemoteImage1 = string.Empty;
            caseInfo.RemoteImage2 = string.Empty;
            //caseInfo.Image3 = string.Empty;
            //caseInfo.Image4 = string.Empty;
            caseInfo.ImageNP               = string.Empty;
            caseInfo.RemoteImageNP         = string.Empty;
            caseInfo.VehicleRegNo          = string.Empty;
            caseInfo.VehicleRegNoConfirmed = false;
            caseInfo.VehicleMake           = string.Empty;
            caseInfo.VehicleModel          = string.Empty;
            caseInfo.VehicleColour         = string.Empty;
            caseInfo.VehicleType           = string.Empty;
            caseInfo.VehicleLicenseExpire  = DateTime.MinValue;
            caseInfo.OffenceDate           = DateTime.MinValue;
            caseInfo.OffenceSpeed          = -1;
            caseInfo.OffenceZone           = -1;
            caseInfo.OffenceDirectionLane  = string.Empty;
            caseInfo.OffenceCode           = -1;
            caseInfo.OffenceNotes          = string.Empty;
            caseInfo.OffenceAdditionalsXml = string.Empty;
            //caseInfo.OnlyOneImage = false;

            return(caseInfo);
        }
Ejemplo n.º 12
0
        public async Task <ActionResult <CaseModel> > PostCaseModel(CaseModel caseModel)
        {
            _context.CaseModels.Add(caseModel);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetCaseModel", new { id = caseModel.id }, caseModel));
        }
Ejemplo n.º 13
0
        public async Task EditCase(CaseModel model, int id)
        {
            var caseInfo = await this.context.Cases.Where(x => x.Id == id).Select(x => new
            {
                Case         = x,
                OrgShortName = x.User.Organization.ShortName,
                UserId       = x.UserId
            }).SingleAsync();

            var hasRightToEdit = this.HasEditDeleteRights(caseInfo.UserId, caseInfo.OrgShortName);

            if (!hasRightToEdit)
            {
                throw new NotAuthorizedException();
            }

            var oldRecord = caseInfo.Case;

            if (oldRecord == null)
            {
                throw new NotFoundException($"Case with id {id} not found");
            }

            oldRecord.Content    = model.Content;
            oldRecord.LastChange = DateTime.Now;
            oldRecord.Caption    = model.Title;


            var caseLog = this.mapper.Map <CaseLog>(oldRecord);

            caseLog.UserId = this.currentUserService.GetCurrentUserIdClaim();
            this.context.CasesLog.Add(caseLog);
            this.SaveAutoCompleteSuggestions(model);
            await this.context.SaveChangesAsync();
        }
Ejemplo n.º 14
0
        public async Task <IActionResult> PutCaseModel(int id, CaseModel caseModel)
        {
            if (id != caseModel.id)
            {
                return(BadRequest());
            }

            _context.Entry(caseModel).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CaseModelExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
Ejemplo n.º 15
0
        public void CreateCaseInBlaise(CaseModel caseModel)
        {
            var dataFields = BuildDataFieldsFromCaseModel(caseModel);

            _blaiseCaseApi.CreateCase(caseModel.PrimaryKey, dataFields,
                                      BlaiseConfigurationHelper.InstrumentName, BlaiseConfigurationHelper.ServerParkName);
        }
Ejemplo n.º 16
0
        public Test_ini()
        {
            this.chars = new char[] { };
            this.chars = CommonData.ASCII_WordText();

            string fp = this.GetFilePath();

            if (File.Exists(fp))
            {
                File.Delete(fp);
            }
            this.ini = new IniFile(fp);
            this.dic = this.GetTestCase();

            NameSign = @"ini配置文件";
            SonCases = new CaseModel[] {
                Func_WriteString(),
                Func_ReadString(),
                Func_GetKeys(),
                Func_GetSections(),
                Func_GetKeyValues(),
                Func_ClearSection(),
                Func_DeleteKey(),
                Func_IsExistsValue(),
            };
        }
Ejemplo n.º 17
0
        public JsonResult SaveCase(string type, string signature, string instance, string id)
        {
            if (!String.IsNullOrEmpty(type) && !String.IsNullOrEmpty(instance) && !String.IsNullOrEmpty(id))
            {
                try
                {
                    var cases = new CaseModel
                    {
                        Type         = type,
                        ActSignature = signature,
                        Instance     = instance,
                        PriceAll     = "0",
                        UserId       = id,
                        AddDate      = DateTime.Now,
                        Status       = false
                    };
                    _cr.Add(cases);
                    _cr.SaveChanges();

                    return(Json(cases, JsonRequestBehavior.AllowGet));
                }
                catch (Exception)
                {
                    return(Json("ERROR", JsonRequestBehavior.AllowGet));
                }
            }
            else
            {
                return(Json("ERROR", JsonRequestBehavior.AllowGet));
            }
        }
Ejemplo n.º 18
0
        public CaseRepo GetCase(int id)
        {
            string sqlString = "SELECT*FROM ViewCases WHERE ID = @id";

            command.Parameters.Clear();
            command.Parameters.Add(new SqlParameter("@id", id));
            PrepareSql(sqlString);
            CaseRepo      c1     = new CaseModel();
            SqlDataReader reader = null;

            reader = command.ExecuteReader();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    c1.Id         = reader["ID"] != DBNull.Value ? Convert.ToInt32(reader["ID"]) : default(int);
                    c1.Name       = reader["CaseName"] != DBNull.Value ? reader["CaseName"].ToString() : String.Empty;
                    c1.StartDate  = reader["StartDate"] != DBNull.Value ? Convert.ToDateTime(reader["StartDate"]) : DateTime.Now;
                    c1.EndDate    = c1.StartDate + TimeSpan.FromDays(Convert.ToInt32(reader["TimeEstimate"]));
                    c1.NegPrice   = reader["NegotiatedPrice"] != DBNull.Value ? Convert.ToDecimal(reader["NegotiatedPrice"]) : default(decimal);
                    c1.TotalPrice = reader["TotalPrice"] != DBNull.Value ? Convert.ToDecimal(reader["TotalPrice"]) : default(decimal);
                    c1.Service    = reader["ServiceName"] != DBNull.Value ? reader["ServiceName"].ToString() : string.Empty;

                    c1.HoursEstimate = reader["HoursEstimate"] != DBNull.Value ? Convert.ToInt32(reader["HoursEstimate"]) : default(int);
                    c1.Client        = $"{(reader["ClientfName"] != DBNull.Value ? reader["ClientfName"].ToString() : string.Empty)} " +
                                       $"{(reader["ClientlName"] != DBNull.Value ? reader["ClientlName"].ToString() : string.Empty)}";

                    c1.RespEmployee = $"{(reader["EmployeefName"] != DBNull.Value ? reader["EmployeefName"].ToString() : string.Empty)} " +
                                      $"{(reader["EmployeelName"] != DBNull.Value ? reader["EmployeelName"].ToString() : string.Empty)}";
                }
            }
            connection.Close();
            return(c1);
        }
Ejemplo n.º 19
0
 public Test_HttpContext()
 {
     NameSign = @"学习-HTTP上下文";
     SonCases = new CaseModel[] {
         Func_MapPath(),
     };
 }
Ejemplo n.º 20
0
 public CaseViewModel(CaseModel caseModel)
 {
     _caseModel = caseModel;
     _apiCommunicator = new APICommunicator();
     _caseModel.CaseAttributeTypes = _apiCommunicator.GetCaseAttributeTypes();
     _caseModel.CaseAttributeCodeListTypes = _apiCommunicator.GetCaseAttributeCodeListTypes();
 }
Ejemplo n.º 21
0
        private void DemineurView_Load(object sender, EventArgs e)
        {
            //timer1.Start();

            left = (this.Width - 32 * Longueur) / 2;

            for (int i = 0; i < Longueur; i++)
            {
                for (int j = 0; j < Largeur; j++)
                {
                    MetroButton button = new MetroButton();
                    button.Height = 32;
                    button.Width  = 32;

                    button.Cursor          = Cursors.Hand;
                    button.BackgroundImage = Properties.Resources.texture_champ;

                    button.BackgroundImageLayout = ImageLayout.Stretch;
                    button.MouseUp += new MouseEventHandler(anybutton_Click);

                    button.Left = left + i * button.Width;
                    button.Top  = top + j * button.Height;

                    listCases[i, j]        = new CaseModel(i, j);
                    listCases[i, j].Button = button;

                    this.Controls.Add(button);
                }
            }

            // Génération des bombes sur le terrain
            GenererBombes();
        }
 public Test_SerializerDeserialize()
 {
     NameSign = @"序列化反序列化";
     SonCases = new CaseModel[] {
         Obj_JSON(),
         Obj_XML(),
     };
 }
Ejemplo n.º 23
0
        public JsonResult SearchCase(string caseNo)
        {
            OrderList order = orderRepo.GetOrder(caseNo);
            var       model = new CaseModel(order);

            //var ojb = model.Order == null ?? new {} : model.Order;
            return(Json(model.Order));
        }
Ejemplo n.º 24
0
 public Test_AbsShineUponParser()
 {
     NameSign = @"映射模型解析器";
     SonCases = new CaseModel[] {
         Func_ColumnModelParser(),
         Func_FieldModelParser(),
         Func_GetValue_SetValue(),
     };
 }
Ejemplo n.º 25
0
 public void CreateCasesInBlaise(int expectedNumberOfCases)
 {
     for (var count = 0; count < expectedNumberOfCases; count++)
     {
         var caseModel = new CaseModel(_primaryKey.ToString(), "110", ModeType.Tel, DateTime.Now.AddHours(-1));
         CreateCaseInBlaise(caseModel);
         _primaryKey++;
     }
 }
Ejemplo n.º 26
0
 public Test_Path()
 {
     NameSign = @"学习-路径";
     SonCases = new CaseModel[] {
         Func_Combine(),
         Func_Abs_Abs_Rel(),
         Func_Abs_Rel_Abs(),
     };
 }
Ejemplo n.º 27
0
        public async Task <ActionResult> CreateCase(CaseModel caseModel)
        {
            var @case = Mapper.mapper.Map <CaseModel, Case>(caseModel);

            @case.Kind = await GetCaseKindByType(caseModel.Kind);
            await CreateCaseAsync(@case);

            return(Json("Success!"));
        }
Ejemplo n.º 28
0
        public void OnSaveCase(CaseModel model)
        {
            if (BeforeSaveCase != null)
            {
                BeforeSaveCase(model);

                this.SaveCase(model);
            }
        }
Ejemplo n.º 29
0
 public void CreateCasesInFile(string extractedFilePath, int expectedNumberOfCases)
 {
     for (var count = 0; count < expectedNumberOfCases; count++)
     {
         var caseModel = new CaseModel(_primaryKey.ToString(), "110", ModeType.Web, DateTime.Now.AddMinutes(-20));
         CreateCaseInFile(extractedFilePath, caseModel);
         _primaryKey++;
     }
 }
        public async Task <IActionResult> SaveCase([FromBody] CaseModel model)
        {
            if (!this.ModelState.IsValid)
            {
                return(this.BadRequest(this.ModelState));
            }
            var id = await this.service.SaveCase(model);

            return(this.Ok(id));
        }
 public Test_FileDataOperating()
 {
     NameSign = @"学习-操作文件";
     SonCases = new CaseModel[] {
         Func_Insert(),
         Func_Delete(),
         Func_Update(),
         //Func_Select(),
     };
 }
 private void AfterGetQueryModel_Extend(CaseModel caseModel)
 {
 }
Ejemplo n.º 33
0
 public ActionResult AddCases(int id, CaseModel caseItem)
 {
     CasesRepository.Create(caseItem, id);
     return RedirectToAction("AddCases", "CreateProject", new { id = id });
 }