Esempio n. 1
0
        public ActionResult Detail(Guid id)
        {
            var contractQuestionaireEntity = _contractQuestionariesService.GetContractQuestionariesById(id);
            var contractQuestionaireModel  = _mapper.Map <ContractQuestionaireViewModel>(contractQuestionaireEntity);

            contractQuestionaireModel.radioWarrantyProvision    = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioCPARS                = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioFARClause            = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioGovFurnishedProperty = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioGQAC        = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioGSAschedule = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioReportingExecCompensation = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioSBsubcontracting          = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioServiceContractReport     = KeyValueHelper.GetYesNo();
            contractQuestionaireModel.radioWarranties = KeyValueHelper.GetYesNo();
            try
            {
                return(PartialView(contractQuestionaireModel));
            }
            catch (Exception ex)
            {
                ModelState.AddModelError(ex.ToString(), ex.Message);
                return(BadRequest(ModelState));
            }
        }
        public ActionResult Add(Guid customerGuid)
        {
            if (customerGuid == Guid.Empty)
            {
                return(StatusCode(401));
            }
            var contacttype = _customerContactTypeService.GetCustomerContactList();
            ContactViewModel contactViewModel = new ContactViewModel();

            contactViewModel.ContactTypeSelectListItems = contacttype.ToDictionary(x => x.ContactTypeGuid, x => x.ContactTypeName);
            contactViewModel.GenderSelectListItems      = KeyValueHelper.getGender();
            contactViewModel.CustomerGuid = customerGuid;
            return(PartialView(contactViewModel));
        }
        public ActionResult Edit(Guid id)
        {
            ContactViewModel contactViewModel = new ContactViewModel();
            var modeldata = _customerContactService.GetDetailsById(id);

            contactViewModel = ObjectMapper <CustomerContact, ContactViewModel> .Map(modeldata);

            var CustomerDetails = _customerService.GetCustomerById(contactViewModel.CustomerGuid);

            contactViewModel.CustomerName = CustomerDetails.CustomerName;
            contactViewModel.ContactTypeSelectListItems = _customerContactTypeService.GetCustomerContactList().ToDictionary(x => x.ContactTypeGuid, x => x.ContactTypeName);
            contactViewModel.GenderSelectListItems      = KeyValueHelper.getGender();
            return(PartialView(contactViewModel));
        }
Esempio n. 4
0
        public IActionResult Edit(Guid id)
        {
            try
            {
                var jobRequestEntity = _jobRequestService.GetDetailsForJobRequestById(id);
                var model            = ContractsMapper.MapJobRequestToViewModel(jobRequestEntity);

                if (model.Parent_ContractGuid == null)
                {
                    model.BaseUrl = "Contract";
                }
                else
                {
                    model.BaseUrl = "Project";
                    var parentContractDetails = _contractRefactorService.GetBasicContractById(model.Parent_ContractGuid ?? Guid.Empty);
                    var parentContractNumber  = parentContractDetails == null ? "N/A" : parentContractDetails.ContractNumber;
                    model.BasicContractInfo.ParentProjectNumber = parentContractDetails == null ? "N/A" : parentContractDetails.ProjectNumber;
                }
                var companyListEntity = _jobRequestService.GetCompanyData();
                var companyList       = _mapper.Map <ICollection <Models.ViewModels.KeyValuePairModel <Guid, string> > >(companyListEntity);
                var companies         = model.Companies;

                var questionaire = _mapper.Map <Models.ViewModels.Contract.ContractQuestionaireViewModel>(jobRequestEntity.Contracts.ContractQuestionaire);
                model.ContractQuestionaire = questionaire;
                List <string> companySelected = new List <string>();
                if (!string.IsNullOrEmpty(companies))
                {
                    var listCompany = companies.Split(",");
                    foreach (var name in listCompany)
                    {
                        companySelected.Add(name);
                    }
                }

                model.CompanySelected = companySelected;
                model.companyList     = companyList;
                model.radioIsIntercompanyWorkOrder = KeyValueHelper.GetYesNo();
                model.ContractGuid         = id;
                model.JobRequestGuid       = id;
                model.farContractViewModel = GetFarContract(model.ContractGuid);
                return(View(model));
            }
            catch (Exception e)
            {
                ModelState.AddModelError("", e.Message);
                return(BadRequest(ModelState));
            }
        }
Esempio n. 5
0
        private FarContractViewModel GetByContractGuid(Guid id, string Action)
        {
            var viewModel           = new FarContractViewModel();
            var contractQuestionary = new ContractQuestionaireViewModel();

            Guid farContractType  = _contractService.GetFarContractTypeGuidById(id);
            var  farContractModel = _farContractTypeService.GetById(farContractType);
            var  list             = _farContractService.GetRequiredData(id, farContractType);

            viewModel.FarContractTypeCode            = farContractModel.Code;
            viewModel.FarContractTypeName            = farContractModel.Title;
            viewModel.ContractGuid                   = id;
            contractQuestionary.DictionaryBoolString = KeyValueHelper.GetYesNo();
            viewModel.ContractQuestionaires          = contractQuestionary;
            viewModel.RequiredFarClauses             = list;
            viewModel.Questionniare                  = _contractQuestionariesService.GetContractQuestionaries(ResourceType.FarContract.ToString(), Action, id).ToList();

            return(viewModel);
        }
Esempio n. 6
0
        protected MapHandler(SerializationInfo info, StreamingContext context)
        {
            Width     = info.GetInt32(nameof(Width));
            Height    = info.GetInt32(nameof(Height));
            Field     = (Field)info.GetValue(nameof(Field), typeof(Field));
            Clearance = (int[, ])info.GetValue(nameof(Clearance), typeof(int[, ]));

            _tempUnits = new KeyValueHelper <int, Actor>
            {
                Key   = (ICollection <int>)info.GetValue($"{nameof(Units)}.keys", typeof(ICollection <int>)),
                Value = (ICollection <Actor>)info.GetValue($"{nameof(Units)}.values", typeof(ICollection <Actor>))
            };
            _tempItems = new KeyValueHelper <int, InventoryHandler>
            {
                Key   = (ICollection <int>)info.GetValue($"{nameof(Items)}.keys", typeof(ICollection <int>)),
                Value = (ICollection <InventoryHandler>)info.GetValue($"{nameof(Items)}.values", typeof(ICollection <InventoryHandler>))
            };
            _tempDoors = new KeyValueHelper <int, Door>
            {
                Key   = (ICollection <int>)info.GetValue($"{nameof(Doors)}.keys", typeof(ICollection <int>)),
                Value = (ICollection <Door>)info.GetValue($"{nameof(Doors)}.values", typeof(ICollection <Door>))
            };
            _tempExits = new KeyValueHelper <int, Exit>
            {
                Key   = (ICollection <int>)info.GetValue($"{nameof(Exits)}.keys", typeof(ICollection <int>)),
                Value = (ICollection <Exit>)info.GetValue($"{nameof(Exits)}.values", typeof(ICollection <Exit>))
            };
            _tempFires = new KeyValueHelper <int, Fire>
            {
                Key   = (ICollection <int>)info.GetValue($"{nameof(Fires)}.keys", typeof(ICollection <int>)),
                Value = (ICollection <Fire>)info.GetValue($"{nameof(Fires)}.values", typeof(ICollection <Fire>))
            };

            PlayerMap      = new int[Width, Height];
            AutoexploreMap = new int[Width, Height];
            Discovered     = new List <Loc>();
        }
Esempio n. 7
0
        public IActionResult Add(Guid id)
        {
            try
            {
                var jobRequestEntity  = _jobRequestService.GetDetailsForJobRequestById(id);
                var model             = ContractsMapper.MapJobRequestToViewModel(jobRequestEntity);
                var companyListEntity = _jobRequestService.GetCompanyData();
                var companyList       = _mapper.Map <ICollection <Models.ViewModels.KeyValuePairModel <Guid, string> > >(companyListEntity);
                if (model.Parent_ContractGuid == null)
                {
                    model.BaseUrl = "Contract";
                }
                else
                {
                    model.BaseUrl = "Project";
                    var parentContractDetails = _contractRefactorService.GetBasicContractById(model.Parent_ContractGuid ?? Guid.Empty);
                    var parentContractNumber  = parentContractDetails == null ? "N/A" : parentContractDetails.ContractNumber;
                    model.BasicContractInfo.ParentProjectNumber = parentContractDetails == null ? "N/A" : parentContractDetails.ProjectNumber;
                }
                model.companyList = companyList;
                model.Status      = (int)JobRequestStatus.ContractRepresentative;
                model.radioIsIntercompanyWorkOrder = KeyValueHelper.GetYesNo();
                model.ContractGuid = id;

                var questionaire = _mapper.Map <Models.ViewModels.Contract.ContractQuestionaireViewModel>(jobRequestEntity.Contracts.ContractQuestionaire);
                model.ContractQuestionaire = questionaire;
                model.farContractViewModel = GetFarContract(model.ContractGuid);
                model.IsNew = true;
                return(View(model));
            }
            catch (Exception e)
            {
                ModelState.AddModelError(e.ToString(), e.Message);
                return(BadRequest(ModelState));
            }
        }
Esempio n. 8
0
 public ActionResult Add(Guid id)
 {
     try
     {
         var contractQuestionaireModel = new ContractQuestionaireViewModel();
         contractQuestionaireModel.ContractGuid              = id;
         contractQuestionaireModel.radioCPARS                = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioFARClause            = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioGovFurnishedProperty = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioGQAC        = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioGSAschedule = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioReportingExecCompensation = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioSBsubcontracting          = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioServiceContractReport     = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioWarranties        = KeyValueHelper.GetYesNo();
         contractQuestionaireModel.radioWarrantyProvision = KeyValueHelper.GetYesNo();
         return(PartialView(contractQuestionaireModel));
     }
     catch (Exception ex)
     {
         ModelState.AddModelError(ex.ToString(), ex.Message);
         return(BadRequest(ModelState));
     }
 }
Esempio n. 9
0
        // TODO: This probably actually needs Steam to close before performing actions again, as Steam caches the info and overwrites it again??
        private async Task HandleWorkshopItemMetadataRemoval(PublishedFile pf, CancellationToken cancelToken)
        {
            var wsf = $"appworkshop_{Id.m_AppId}.acf";
            var reg = Directories.Workshop.RootPath.GetChildFileWithName(wsf);

            MainLog.Logger.Info($"Considering rewriting {wsf}");
            if (!reg.Exists)
            {
                return;
            }

            var kv = await KeyValueHelper.LoadFromFileAsync(reg, cancelToken).ConfigureAwait(false);

            var changed = false;
            var key     = pf.Pid.m_PublishedFileId.ToString();

            foreach (
                var root in
                new[] {
                "WorkshopItemDetails",
                "WorkshopItemsInstalled"
            }.Select(r => kv.GetKeyValue(r)).Where(root => root.ContainsKey(key)))
            {
                MainLog.Logger.Info($"Removing {key} from {root.Name}");
                root.Remove(key);
                changed = true;
            }

            if (changed)
            {
                MainLog.Logger.Info($"Changes detected, saving {wsf}");
                var id = kv["WorkshopItemsInstalled"];
                kv["SizeOnDisk"].Value = id.Children.Sum(x => x["size"].AsLong()).ToString();
                KeyValueHelper.SaveToFile(kv, reg);
            }
        }
        public IActionResult Export(string jsontree, string exclename)
        {
            try
            {
                if (string.IsNullOrEmpty(exclename))
                {
                    return(Ok("exclename不能为空!"));
                }
                var tempName = "temp";
                var rootPath = @"F://Temp";
                //var rootPath = @"http://192.168.0.105:8080//app";
                if (System.IO.Directory.Exists(rootPath) == false)
                {
                    System.IO.Directory.CreateDirectory(rootPath);
                }
                var newFile = rootPath + "//" + tempName + ".xls";
                if (System.IO.File.Exists(newFile))
                {
                    System.IO.File.Delete(newFile);
                }
                var client = new RestClient(Configuration["ConnectionStrings:JavaServerPath"].ToString());
                // client.Authenticator = new HttpBasicAuthenticator(username, password);
                var request = new RestRequest("getAnalysisData", Method.POST);

                request.AddParameter("Content-Type", "multipart/form-data; boundary=<calculated when request is sent>");
                //string jsonstr = "{\"id\":5,\"parentid\":4,\"menuename\":\"拆除未尽区\",\"type\":\"polygon\",\"createtime\":\"2020-06-17 00:00:00\",\"subAnalysisMenue\":[],\"tablename\":\"ccwjq\"}";
                //  string jsonstr = "{\"id\":2,\"parentid\":1,\"menuename\":\"权属分析\",\"type\":\"polygon\",\"createtime\":\"2020-06-17 00:00:00\",\"subAnalysisMenue\":[],\"tablename\":\"dltb\"}";
                request.AddParameter("jsonTree", jsontree); // adds to POST or URL querystring based on Method
                                                            //   request.AddParameter("jsonTree", jsonstr);
                                                            // execute the request
                IRestResponse response = client.Execute(request);
                JObject       jobj     = (JObject)JsonConvert.DeserializeObject(response.Content);
                //JsonStr为Json字符串
                JArray array = JsonConvert.DeserializeObject(jobj["result"].ToString()) as JArray;//反序列化为数组
                if (array.Count > 0)
                {
                    using (var fs = new FileStream(newFile, FileMode.Create, FileAccess.Write))
                    {
                        IWorkbook workbook = new XSSFWorkbook();


                        var sheet = workbook.CreateSheet("Data");

                        var header = sheet.CreateRow(0);


                        JObject objColumns  = array[0] as JObject;
                        int     headerCount = 0;
                        //构造表头
                        foreach (JToken jkon in objColumns.AsJEnumerable <JToken>())
                        {
                            string name = ((JProperty)(jkon)).Name.ToUpper();
                            if (name == "AREA" || name == "OBJECTID" || name == "SHAPE")
                            {
                                continue;
                            }
                            KeyValueHelper.matchKey   = ":";
                            KeyValueHelper.matchValue = ",";
                            Dictionary <object, object> conents = KeyValueHelper.GetConentByString(KeyValueHelper.data);
                            if (conents.ContainsKey(name))
                            {
                                name = conents[name.ToUpper()].ToString();
                            }
                            header.CreateCell(headerCount).SetCellValue(name);
                            headerCount++;
                        }
                        //向表中添加数据
                        for (int i = 0; i < array.Count; i++)
                        {
                            var     datarow   = sheet.CreateRow(i + 1);
                            JObject obj       = array[i] as JObject;
                            int     cellCount = 0;
                            foreach (JToken jkon in obj.AsJEnumerable <JToken>())
                            {
                                string Name = ((JProperty)(jkon)).Name.ToString().ToUpper();
                                if (Name == "AREA" || Name == "OBJECTID" || Name == "SHAPE")
                                {
                                    continue;
                                }
                                string value = ((JProperty)(jkon)).Value.ToString();
                                datarow.CreateCell(cellCount).SetCellValue(value);
                                cellCount++;
                            }
                        }
                        workbook.Write(fs);
                    }
                }
                else
                {
                    return(BadRequest());
                }
                var memory = new MemoryStream();
                using (var stream = new FileStream(newFile, FileMode.Open))
                {
                    stream.CopyTo(memory);
                }
                memory.Position = 0;
                if (System.IO.File.Exists(newFile))
                {
                    System.IO.File.Delete(newFile);
                }
                if (System.IO.Directory.Exists(rootPath) == true)
                {
                    System.IO.Directory.Delete(rootPath);
                }
                return(File(memory, "application/vnd.ms-excel", exclename + "11.xlsx"));
            }
            catch (Exception ex)
            {
                return(Ok(ex.Message.ToString()));
            }
        }