Exemplo n.º 1
0
        public async Task Insert(ContractView entity)
        {
            try
            {
                Contract vList = new Contract
                {
                    //lstContract.Contract_Id = entity.Contract_Id,
                    Company_Id           = entity.Company_Id,
                    Contract_Code        = entity.Contract_Code,
                    Contract_Name        = entity.Contract_Name,
                    Contract_HoursDaily  = entity.Contract_HoursDaily,
                    Contract_HoursWeekly = entity.Contract_HoursWeekly,
                    Contract_Days        = entity.Contract_Days,
                    Contract_Type        = entity.Contract_Type,

                    isActive = entity.isActive,

                    AddedBy = entity.AddedBy,
                    AddedOn = DateTime.Now
                };

                adbContext.contract.Add(vList);
                await Task.FromResult(adbContext.SaveChanges());
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        public async Task <IActionResult> Edit(ContractView contract)
        {
            ResponseHelper objHelper = new ResponseHelper();

            if (!ModelState.IsValid)
            {
                objHelper.Status  = StatusCodes.Status424FailedDependency;
                objHelper.Message = "Invalid Model State";
                return(BadRequest(objHelper));
            }

            try
            {
                if (ContractRepository.Exists(contract))
                {
                    objHelper.Status  = StatusCodes.Status200OK;
                    objHelper.Message = "Data already available";
                    return(Ok(objHelper));
                }

                await ContractRepository.Update(contract);

                objHelper.Status  = StatusCodes.Status200OK;
                objHelper.Message = "Saved Successfully";
                return(Ok(objHelper));
            }
            catch
            {
                objHelper.Status  = StatusCodes.Status500InternalServerError;
                objHelper.Message = "Save Unsuccessful";
                return(StatusCode(StatusCodes.Status500InternalServerError, objHelper));
            }
        }
Exemplo n.º 3
0
        public ActionResult Add(ContractView contractView)
        {
            if (ModelState.IsValid)
            {
                IContractsRepository contractsRepository = new ContractsRepository(db);
                Contract             contract            = new Contract();

                contractView.ConvertTo(contractView, contract);

                contractsRepository.Add(contract);
                contractsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("INSERT", contract.ContractPK);

                if (TempData["legalEntityFK"] != null)
                {
                    return(RedirectToAction("Index", "LegalEntity"));
                }
                else
                {
                    return(RedirectToAction("Index", "Contract"));
                }
            }
            else
            {
                contractView.BindDDLs(contractView, db);

                return(View(contractView));
            }
        }
Exemplo n.º 4
0
        public async Task Update(ContractView entity)
        {
            try
            {
                var vList = adbContext.contract.Where(x => x.Contract_Id == entity.Contract_Id).FirstOrDefault();
                if (vList != null)
                {
                    //lstContract.Contract_Id = entity.Contract_Id;
                    vList.Company_Id           = entity.Company_Id;
                    vList.Contract_Code        = entity.Contract_Code;
                    vList.Contract_Name        = entity.Contract_Name;
                    vList.Contract_HoursDaily  = entity.Contract_HoursDaily;
                    vList.Contract_HoursWeekly = entity.Contract_HoursWeekly;
                    vList.Contract_Days        = entity.Contract_Days;
                    vList.Contract_Type        = entity.Contract_Type;
                    vList.Notes     = entity.Notes;
                    vList.isActive  = entity.isActive;
                    vList.UpdatedBy = entity.UpdatedBy;
                    vList.UpdatedOn = DateTime.Now;

                    adbContext.contract.Update(vList);
                    await Task.FromResult(adbContext.SaveChanges());
                }
                else
                {
                    throw new Exception("Data Not Available");
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        private void ContractFormShow(int crudMode)
        {
            AppJournal.Write("Company", "Open contract - " + (crudMode == 1 ? "New" : SelectedContract.number), true);

            if (Company.id != 0)
            {
                if (crudMode == 1)
                {
                    SelectedContract = null;
                }

                ContractViewModel contractViewModel = new ContractViewModel(Company.id, this, SelectedContract)
                {
                    Description = "Договора №" + (crudMode == 1 ? "" : SelectedContract.number)
                };

                ContractView contractView = new ContractView();
                contractViewModel.View = contractView;

                Workspace.This.Panels.Add(contractViewModel);
                Workspace.This.ActiveDocument = contractViewModel;
            }
            else
            {
                MessagesService.Show("ОПОВЕЩЕНИЕ", "Ваша компания не сохранена");
            }
        }
Exemplo n.º 6
0
        public async Task <IActionResult> GetContractView(long contractId)
        {
            ContractModule invMod = new ContractModule();

            ContractView view = await invMod.Contract.Query().GetViewById(contractId);

            return(Ok(view));
        }
Exemplo n.º 7
0
    static void Init()
    {
        ContractView editor = (ContractView)GetWindow(typeof(ContractView));

        editor.minSize = new Vector2(600, 600);
        ContractModel.LoadContracts();
        editor.Show();
    }
Exemplo n.º 8
0
        public async Task TestAddUpdatDelete()
        {
            ServiceInformationModule ServiceInformationMod = new ServiceInformationModule();
            LocationAddressView      locationAddressView   = await ServiceInformationMod.LocationAddress.Query().GetViewById(3);

            CustomerView customerView = await ServiceInformationMod.Customer.Query().GetViewById(3);

            AddressBook addressBook = await ServiceInformationMod.AddressBook.Query().GetEntityById(customerView.AddressId);

            ContractView contractView = await ServiceInformationMod.Contract.Query().GetViewById(1);

            Udc udc = await ServiceInformationMod.Udc.Query().GetEntityById(2);


            ServiceInformationView view = new ServiceInformationView()
            {
                ServiceDescription = " truck oil change",
                Price                 = 80.76M,
                AddOns                = "none",
                ServiceTypeXrefId     = udc.XrefId,
                ServiceType           = udc.Value,
                CreatedDate           = DateTime.Parse("12/25/2019"),
                LocationId            = locationAddressView.LocationAddressId,
                CustomerId            = customerView.CustomerId,
                ContractId            = contractView.ContractId,
                vwCustomer            = customerView,
                vwContract            = contractView,
                vwLocationAddress     = locationAddressView,
                SquareFeetOfStructure = 100,
                LocationDescription   = "Eiensten brothers on orchard",
                LocationGps           = "",
                Comments              = "",
                Status                = true
            };
            NextNumber nnNextNumber = await ServiceInformationMod.ServiceInformation.Query().GetNextNumber();

            view.ServiceInformationNumber = nnNextNumber.NextNumberValue;

            ServiceInformation serviceInformation = await ServiceInformationMod.ServiceInformation.Query().MapToEntity(view);

            ServiceInformationMod.ServiceInformation.AddServiceInformation(serviceInformation).Apply();

            ServiceInformation newServiceInformation = await ServiceInformationMod.ServiceInformation.Query().GetEntityByNumber(view.ServiceInformationNumber);

            Assert.NotNull(newServiceInformation);

            newServiceInformation.ServiceDescription = "ServiceInformation Test Update";

            ServiceInformationMod.ServiceInformation.UpdateServiceInformation(newServiceInformation).Apply();

            ServiceInformationView updateView = await ServiceInformationMod.ServiceInformation.Query().GetViewById(newServiceInformation.ServiceId);

            Assert.Same(updateView.ServiceDescription, "ServiceInformation Test Update");
            ServiceInformationMod.ServiceInformation.DeleteServiceInformation(newServiceInformation).Apply();
            ServiceInformation lookupServiceInformation = await ServiceInformationMod.ServiceInformation.Query().GetEntityById(view.ServiceId);

            Assert.Null(lookupServiceInformation);
        }
Exemplo n.º 9
0
        public async Task <IActionResult> DeleteContract([FromBody] ContractView view)
        {
            ContractModule invMod   = new ContractModule();
            Contract       contract = await invMod.Contract.Query().MapToEntity(view);

            invMod.Contract.DeleteContract(contract).Apply();

            return(Ok(view));
        }
Exemplo n.º 10
0
        public ActionResult Index()
        {
            IContractsRepository      contractsRepository      = new ContractsRepository(db);
            ILegalEntitiesRepository  legalEntitiesRepository  = new LegalEntitiesRepository(db);
            IAnnexContractsRepository annexContractsRepository = new AnnexContractsRepository(db);

            int    page       = !String.IsNullOrWhiteSpace(Request.QueryString["page"]) ? Convert.ToInt32(Request.QueryString["page"]) : 1;
            int    pageSize   = !String.IsNullOrWhiteSpace(Request.QueryString["pageSize"]) ? Convert.ToInt32(Request.QueryString["pageSize"]) : Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["ResultsPerPage"]);
            string sortOrder  = !String.IsNullOrWhiteSpace(Request.QueryString["sortOrder"]) ? Request.QueryString["sortOrder"] : "DESC";
            string sortColumn = !String.IsNullOrWhiteSpace(Request.QueryString["sortColumn"]) ? Request.QueryString["sortColumn"] : "ContractPK";
            string ordering   = sortColumn + " " + sortOrder;

            ordering = ordering.Trim();

            IQueryable <ContractView> contracts = ContractView.GetContractsView(contractsRepository.GetValid(), annexContractsRepository.GetValid(), legalEntitiesRepository.GetValidLegalEntities())
                                                  .OrderBy(ordering);

            //legalEntities ddl
            ViewBag.LegalEntities = new SelectList(legalEntitiesRepository.GetValidLegalEntities().OrderBy("Name ASC").ToList(), "LegalEntityPK", "Name", Request.QueryString["legalEntityFK"]);

            if (!String.IsNullOrWhiteSpace(Request.QueryString["searchString"]))
            {
                string searchString = Request.QueryString["searchString"].ToString();
                contracts = contracts.Where(c => c.Name.Contains(searchString));
            }

            if (!String.IsNullOrWhiteSpace(Request.QueryString["legalEntityFK"]))
            {
                int legalEntityFK = Convert.ToInt32(Request.QueryString["legalEntityFK"]);
                contracts = contracts.Where(c => c.LegalEntityFK == legalEntityFK);
            }

            contracts = contracts.Page(page, pageSize);

            if (!String.IsNullOrWhiteSpace(Request.QueryString["searchString"]))
            {
                string searchString = Request.QueryString["searchString"].ToString();
                ViewData["numberOfRecords"] = contractsRepository.GetValid().Where(c => c.Name.Contains(searchString)).Count();
            }
            else
            {
                ViewData["numberOfRecords"] = contractsRepository.GetValid().Count();
            }

            int numberOfPages = ((int)ViewData["numberOfRecords"] + pageSize - 1) / pageSize;

            if (page > numberOfPages)
            {
                string url = LinkHelper.getQueryStringArray(new string[] { "page" });
                return(Redirect("Contract?" + url + "page=" + numberOfPages));
            }
            else
            {
                return(View("Index", contracts.ToList()));
            }
        }
Exemplo n.º 11
0
        //[AuthorizeUser(ActionName = "Contracte", Recursive = false)]
        public JsonResult Details(int id)                       // id proces
        {
            string       conStr = Session["conStr"].ToString(); //ConfigurationManager.ConnectionStrings["MySQLConnectionString"].ConnectionString;
            ContractView cv     = new ContractView(Convert.ToInt32(Session["CURENT_USER_ID"]), id, conStr);
            JsonResult   result = Json(Newtonsoft.Json.JsonConvert.SerializeObject(cv, Newtonsoft.Json.Formatting.None, new Newtonsoft.Json.Converters.IsoDateTimeConverter()
            {
                DateTimeFormat = SOCISA.CommonFunctions.DATE_FORMAT
            }), JsonRequestBehavior.AllowGet);

            result.MaxJsonLength = Int32.MaxValue;
            return(result);
        }
Exemplo n.º 12
0
        public bool Exists(ContractView entity)
        {
            int intCount = 0;

            if (entity.Contract_Id > 0) //Update Validation
            {
                intCount = adbContext.contract.Where(w => w.Company_Id == entity.Company_Id && w.Contract_Id != entity.Contract_Id && (w.Contract_Code == entity.Contract_Code || w.Contract_Name == entity.Contract_Name)).Count();
            }
            else //Insert Validation
            {
                intCount = adbContext.contract.Where(w => w.Company_Id == entity.Company_Id && (w.Contract_Code == entity.Contract_Code || w.Contract_Name == entity.Contract_Name)).Count();
            }
            return(intCount > 0 ? true : false);
        }
Exemplo n.º 13
0
        public async Task <IActionResult> UpdateContract([FromBody] ContractView view)
        {
            ContractModule invMod = new ContractModule();

            Contract contract = await invMod.Contract.Query().MapToEntity(view);


            invMod.Contract.UpdateContract(contract).Apply();

            ContractView retView = await invMod.Contract.Query().GetViewById(contract.ContractId);


            return(Ok(retView));
        }
Exemplo n.º 14
0
        public async Task <IActionResult> AddContract([FromBody] ContractView view)
        {
            ContractModule invMod = new ContractModule();

            NextNumber nnContract = await invMod.Contract.Query().GetNextNumber();

            view.ContractNumber = nnContract.NextNumberValue;

            Contract contract = await invMod.Contract.Query().MapToEntity(view);

            invMod.Contract.AddContract(contract).Apply();

            ContractView newView = await invMod.Contract.Query().GetViewByNumber(view.ContractNumber);


            return(Ok(newView));
        }
Exemplo n.º 15
0
        public ActionResult Edit(int?contractPK)
        {
            if (contractPK != null)
            {
                IContractsRepository contractsRepository = new ContractsRepository(db);
                Contract             contract            = contractsRepository.GetContractByPK((int)contractPK);
                ContractView         contractView        = new ContractView();

                contractView.ConvertFrom(contract, contractView, db);
                contractView.BindDDLs(contractView, db);

                return(View(contractView));
            }
            else
            {
                return(RedirectToAction("Index", "Contract"));
            }
        }
Exemplo n.º 16
0
        public ActionResult Add(int?legalEntityFK)
        {
            ContractView contractView = new ContractView();

            if (legalEntityFK != null)
            {
                TempData["legalEntityFK"] = legalEntityFK;

                contractView.LegalEntityFK = (int)legalEntityFK;

                ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db);
                contractView.LegalEntityName = legalEntitiesRepository.GetLegalEntityByPK((int)legalEntityFK).Name;
            }

            contractView.BindDDLs(contractView, db);

            return(View(contractView));
        }
Exemplo n.º 17
0
        Dictionary <string, string> PopulateFieldsInfo()
        {
            Dictionary <string, string> dic = new Dictionary <string, string>();

            dic.Add("«ContractNo»", _contract.ContractNo.ToString());
            dic.Add("«Day»", _contract.SignDay);
            dic.Add("«Hij»", Helper.PutMask(_contract.SignHijriDate) + " هـ");
            dic.Add("«Greg»", Helper.PutMask(_contract.SignGregDate) + " م");
            dic.Add("«CusName»", _contract.Customer.Name);
            dic.Add("«CustId»", _contract.Customer.IdNumber);
            dic.Add("«IdIssueAt»", _contract.Customer.IdIssue);
            dic.Add("«IdIssueDate»", Helper.PutMask(_contract.Customer.IdDate));
            dic.Add("«RepName»", _representative.CustomerId == -1 ? "------------" : _representative.Name);
            dic.Add("«RepId»", _representative.Id);
            dic.Add("«RepIssue»", _representative.IssueAt);
            dic.Add("«RepDate»", Helper.PutMask(_representative.IdDate));
            dic.Add("«Address1»", _contract.Customer.AddressLine1);
            dic.Add("«Address2»", _contract.Customer.AddressLine2);
            dic.Add("«PropertyName»", _contract.Property.Location);
            dic.Add("«Activity»", _contract.ContractsActivity != null ? _contract.ContractsActivity.Description : "------------");
            dic.Add("«PropNo»", ContractView.ExtractProeprtyNo(_contract.Property.PropertyNo));
            dic.Add("«Location»", _contract.Property.Location);
            dic.Add("«StartDate»", Helper.PutMask(_startDate) + " هـ");
            dic.Add("«EndDate»", Helper.PutMask(_endDate) + " هـ");
            dic.Add("«Rent»", _contract.AgreedRent.ToString("#,0") + " ريـال");
            dic.Add("«RentWords»", SayNumber.ToWords(_contract.AgreedRent));
            if (_contract.AgreedDeposit == 0)
            {
                dic.Add("«Deposit»", "-----");
                dic.Add("«DepositWords»", "-------");
            }
            else
            {
                dic.Add("«Deposit»", _contract.AgreedDeposit.ToString("#,0") + " ريـال");
                dic.Add("«DepositWords»", SayNumber.ToWords(_contract.AgreedDeposit));
            }

            return(dic);
        }
Exemplo n.º 18
0
        public ActionResult Edit(ContractView contractView)
        {
            if (ModelState.IsValid)
            {
                IContractsRepository contractsRepository = new ContractsRepository(db);

                Contract contract = contractsRepository.GetContractByPK((int)contractView.ContractPK);
                contractView.ConvertTo(contractView, contract);

                contractsRepository.SaveChanges();

                TempData["message"] = LayoutHelper.GetMessage("UPDATE", contract.ContractPK);

                return(RedirectToAction("Index", "Contract"));
            }
            else
            {
                contractView.BindDDLs(contractView, db);

                return(View(contractView));
            }
        }
Exemplo n.º 19
0
        private async void showContracts_ClickAsync(object sender, RoutedEventArgs e)
        {
            currentPage   = 1;
            currentView   = "ContractView";
            currentEntity = "contracts";
            ContractView[] arr = new ContractView[0];
            arr = await GetEntityPaged <ContractView>("contracts", pageSize, currentPage);

            dataGrid.ItemsSource = arr;


            KeyValuePair <string, int>[] graphData =
                new KeyValuePair <string, int> [arr.Length];
            for (int i = 0; i < graphData.Length; i++)
            {
                graphData[i] =
                    new KeyValuePair <string, int>(arr[i].MovieTitle, arr[i].Salary);
            }
            ((ColumnSeries)myChart.Series[0]).Title       = "Salary";
            ((ColumnSeries)myChart.Series[0]).ItemsSource = graphData;

            PageChangeSetup();
            chartSwapper.IsEnabled = true;
        }
Exemplo n.º 20
0
        //[PITAuthorize(Roles = "add, edit, view, delete")]
        public ActionResult LegalEntity(int?legalEntityFK, string ShowBasicInfo, string ShowLegalEntityHistory, string ShowLegalEntityLegalRepresentatives, string ShowLegalEntityLegalRepresentativesHistory, string ShowLegalEntityBanks, string ShowLegalEntityBanksHistory, string ShowContracts, string ShowBranches, string ShowBranchesHistory, string ShowLegalEntityOwners, string ShowLegalEntityOwnersHistory)
        {
            LegalEntityView legalEntityView = new LegalEntityView();

            ILegalEntitiesRepository legalEntitiesRepository = new LegalEntitiesRepository(db);

            if (legalEntityFK != null)
            {
                int legalEntityPK = (int)legalEntityFK;

                if (ShowBasicInfo == "on" || ShowBasicInfo == "true")
                {
                    legalEntityView = LegalEntityView.GetLegalEntityReport(db, legalEntityPK);
                }

                if (ShowLegalEntityLegalRepresentatives == "on" || ShowLegalEntityLegalRepresentatives == "true")
                {
                    IPhysicalEntitiesRepository physicalEntitiesRepository = new PhysicalEntitiesRepository(db);
                    ILegalEntityLegalRepresentativesRepository legalEntityLegalRepresentativesRepository = new LegalEntityLegalRepresentativesRepository(db);

                    IQueryable <LegalEntityLegalRepresentativeView> legalEntityLegalRepresentatives = LegalEntityLegalRepresentativeView.GetLegalEntityLegalRepresentativeView(legalEntityLegalRepresentativesRepository.GetValid(), legalEntitiesRepository.GetValidLegalEntities(), physicalEntitiesRepository.GetValid());

                    ViewBag.LegalEntityLegalRepresentatives = legalEntityLegalRepresentatives.Where(c => c.LegalEntityFK == legalEntityPK).ToList();
                }

                if (ShowLegalEntityBanks == "on" || ShowLegalEntityBanks == "true")
                {
                    ILegalEntityBanksRepository legalEntitiesBanksRepository = new LegalEntityBanksRepository(db);
                    IBanksRepository            banksRepository = new BanksRepository(db);

                    IQueryable <LegalEntityBankView> legalEntitiesBanks = LegalEntityBankView.GetLegalEntityBankView(legalEntitiesBanksRepository.GetValid(), banksRepository.GetValid(), legalEntitiesRepository.GetValidLegalEntities());

                    ViewBag.LegalEntityBanks = legalEntitiesBanks.Where(c => c.LegalEntityFK == legalEntityPK).ToList();
                }

                if (ShowContracts == "on" || ShowContracts == "true")
                {
                    IContractsRepository      contractsRepository      = new ContractsRepository(db);
                    IAnnexContractsRepository annexContractsRepository = new AnnexContractsRepository(db);

                    IQueryable <ContractView> contracts = ContractView.GetContractsView(contractsRepository.GetValid(), annexContractsRepository.GetValid(), legalEntitiesRepository.GetValidLegalEntities());

                    ViewBag.Contracts = contracts.Where(c => c.LegalEntityFK == legalEntityPK).ToList();
                }

                if (ShowBranches == "on" || ShowBranches == "true")
                {
                    ILegalEntityBranchesRepository legalEntityBranchesRepository = new LegalEntityBranchesRepository(db);

                    IQueryable <LegalEntityBranchView> legalEntityBranches = LegalEntityBranchView.GetLegalEntityBranchView(legalEntityBranchesRepository.GetValid(), legalEntitiesRepository.GetValidLegalEntities());

                    ViewBag.Branches = legalEntityBranches.Where(c => c.LegalEntityFK == legalEntityPK).ToList();
                }

                // history
                if (ShowLegalEntityHistory == "on" || ShowLegalEntityHistory == "true")
                {
                    List <LegalEntityAuditView> legalEntityHistory = LegalEntityAuditView.GetLegalEntityAuditView(db, legalEntityPK);
                    ViewBag.legalEntityHistory = legalEntityHistory.ToList();
                }

                if (ShowLegalEntityBanksHistory == "on" || ShowLegalEntityBanksHistory == "true")
                {
                    List <List <LegalEntityBankAuditView> > legalEntityBanksHistory = LegalEntityBankAuditView.GetLegalEntityBanksAuditView(db, legalEntityPK);

                    List <DateTime> legalEntityBanksDatesHistory = new List <DateTime>();

                    foreach (List <LegalEntityBankAuditView> legalEntityBank in legalEntityBanksHistory)
                    {
                        foreach (LegalEntityBankAuditView legalEntityBankAuditView in legalEntityBank)
                        {
                            if (!legalEntityBanksDatesHistory.Contains(legalEntityBankAuditView.ChangeDate.Value))
                            {
                                legalEntityBanksDatesHistory.Add(legalEntityBankAuditView.ChangeDate.Value);
                            }
                        }
                    }

                    ViewBag.legalEntityBanksDatesHistory = legalEntityBanksDatesHistory.OrderBy(c => c.Date).ToList();
                    ViewBag.legalEntityBanksHistory      = legalEntityBanksHistory;
                }

                if (ShowLegalEntityLegalRepresentativesHistory == "on" || ShowLegalEntityLegalRepresentativesHistory == "true")
                {
                    List <List <LegalEntityLegalRepresentativeAuditView> > legalEntityLegalRepresentativesHistory = LegalEntityLegalRepresentativeAuditView.GetLegalEntityLegalRepresentativesAuditView(db, legalEntityPK);
                    ViewBag.legalEntityLegalRepresentativesHistory = legalEntityLegalRepresentativesHistory;
                }

                if (ShowLegalEntityOwnersHistory == "on" || ShowLegalEntityOwnersHistory == "true")
                {
                    List <List <LegalEntityOwnerAuditView> > legalEntityOwnersHistory = LegalEntityOwnerAuditView.GetLegalEntityOwnersAuditView(db, legalEntityPK);
                    ViewBag.legalEntityOwnersHistory = legalEntityOwnersHistory;
                }

                if (ShowBranchesHistory == "on" || ShowBranchesHistory == "on")
                {
                    List <List <LegalEntityBranchAuditView> > legalEntityBranchesHistory = LegalEntityBranchAuditView.GetLegalEntityBranchesAuditView(db, legalEntityPK);
                    ViewBag.legalEntityBranchesHistory = legalEntityBranchesHistory;
                }
            }

            return(View(legalEntityView));
        }
Exemplo n.º 21
0
        private void OpenContract(object sender, RoutedEventArgs e)
        {
            var v = new ContractView();

            ShowChild(v);
        }
Exemplo n.º 22
0
        public override object Execute()
        {
            string EProjectRelationId = this._context.strBOID;//合同ID
            EcommerceProjectRelationEntity ecommerceprojectrelationEntity = eprBll.GetEntity(EProjectRelationId);
            OP_ParcelEntity op_parcelEntity = op_parcelbll.GetEntityByproid(ecommerceprojectrelationEntity.ProjectID);
            IEnumerable <EcommerceDiscountProgramEntity> discount = edpbll.GetEntity(EProjectRelationId);
            List <T_AttachmentEntity> attaclist = tabll.GetFormList(EProjectRelationId, "default");
            ContractView       cv    = new ContractView();
            List <ITEM>        its   = new List <ITEM>();
            List <ATTACHMENT1> attcs = new List <ATTACHMENT1>();

            cv.ProjectName        = ecommerceprojectrelationEntity.ProjecName;
            cv.ProjCode           = op_parcelEntity.ParcelCode.Replace("-", ".");
            cv.ProjectType        = EnumHelper.ToDescription((ProjectTypeEnum)ecommerceprojectrelationEntity.ProjectType);
            cv.OrgName            = ecommerceprojectrelationEntity.CompanyName;
            cv.OrgCode            = ecommerceprojectrelationEntity.CompanyId;
            cv.EcommerceGroupName = ecommerceprojectrelationEntity.EcommerceGroupName;
            cv.EcommerceTypeName  = ecommerceprojectrelationEntity.EcommerceTypeName;
            cv.ContractName       = ecommerceprojectrelationEntity.ContractName;
            cv.ContractNature     = EnumHelper.ToDescription((ContractNatureEnum)ecommerceprojectrelationEntity.ContractNature);
            cv.ContractTypeName   = ecommerceprojectrelationEntity.ContractTypeName;
            cv.IsStandard         = ecommerceprojectrelationEntity.IsStandard == 0?"否":"是";
            cv.PartyA             = ecommerceprojectrelationEntity.PartyA;
            cv.PartyB             = ecommerceprojectrelationEntity.PartyB;
            cv.CooperateStartTime = Convert.ToDateTime(ecommerceprojectrelationEntity.CooperateStartTime).ToString("yyyy-MM-dd");
            cv.CooperateEndTime   = Convert.ToDateTime(ecommerceprojectrelationEntity.CooperateEndTime).ToString("yyyy-MM-dd");
            cv.BiddingMethod      = EnumHelper.ToDescription((BiddingMethodEnum)ecommerceprojectrelationEntity.BiddingMethod);
            cv.IsStamp            = ecommerceprojectrelationEntity.IsStamp == 0?"否":"是";
            cv.Agent               = ecommerceprojectrelationEntity.Agent;
            cv.CreateDate          = Convert.ToDateTime(ecommerceprojectrelationEntity.CreateDate).ToString("yyyy-MM-dd");
            cv.ForceContractAmount = ecommerceprojectrelationEntity.ForceContractAmount;
            cv.PlatformRate        = ecommerceprojectrelationEntity.PlatformRate;
            foreach (var item in discount)
            {
                ITEM it = new ITEM();
                it.Format   = item.Format;
                it.Amount   = item.Amount;
                it.Discount = item.Discount;
                if (!its.Contains(it))
                {
                    its.Add(it);
                }
            }
            cv.BDITEM      = new BDITEM();
            cv.BDITEM.item = its.ToArray();

            var    geturl  = dataItemCache.GetDataItemByCodeAndName("SysConfig", "BPMAttacPath");
            string urlname = geturl.ItemValue;

            foreach (var item in attaclist)
            {
                ATTACHMENT1 attc = new ATTACHMENT1();
                attc.FILENAME = item.AttachmentName;
                attc.URL      = string.Format("{0}/{1}", urlname, item.Path);
                if (!attcs.Contains(attc))
                {
                    attcs.Add(attc);
                }
            }
            cv.ATTACHMENT            = new ATTACHMENT();
            cv.ATTACHMENT.attachment = attcs.ToArray();
            var d = Movit.Util.XmlHelper.Serializer(typeof(ContractView), cv);

            return(d);
            //XmlDocument doc = new XmlDocument();
            //XmlDeclaration dec = doc.CreateXmlDeclaration("1.0", "utf-16", null);
            //doc.AppendChild(dec);
            ////创建一个根节点(一级)
            //XmlNode root = doc.CreateElement("DATA");
            //doc.AppendChild(root);
            ////创建节点(二级)
            //XmlElement ITEM = null;
            //XmlElement element = null;
            ////合同编号
            //element = doc.CreateElement("ProjectName");
            //element.SetAttribute("Text", "项目名称");
            //element.InnerText = ecommerceprojectrelationEntity.EcommerceProjectRelationID;
            ////项目名称
            //element = doc.CreateElement("CompanyName");
            //element.SetAttribute("Text", "所属区域");
            //element.InnerText = ecommerceprojectrelationEntity.ProjectName;
            //root.AppendChild(element);

            //ITEM = doc.CreateElement("优化方案Items");
            //ITEM.SetAttribute("ID", "BudgetItem");
            //root.AppendChild(ITEM);
            //foreach (var item in tcollection)
            //{
            //    XmlNode item = doc.CreateElement("item");

            //    //创建节点(三级)
            //    element = null;

            //    //集团/地区公司GUID
            //    element = doc.CreateElement("OrgUnitGUID");
            //    element.SetAttribute("Text", "集团/地区公司");
            //    element.InnerText = "三级节点数据";
            //    item.AppendChild(element);
            //}

            //return XmlHelper.ConvertXmlToString(doc);
        }