예제 #1
0
        //выбор элемента для переноса
        private void dgv_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            _currentBreaker       = bs_ProjectCbr.Current as ProjectCbr;
            _currentBreaker.Title = ConfigServices.GetCbrTitle(bs_ProjectCbr.Current as ProjectCbr);

            dgvProjectCbr.DoDragDrop(_currentBreaker.Title, DragDropEffects.Copy);
        }
예제 #2
0
        //загрузка формы
        private void frmBlock_Load(object sender, EventArgs e)
        {
            List <BlockEquipment> listBlockEquip = ConfigServices.GetAllBlockEquip(_idBlock);

            foreach (BlockEquipment beq in listBlockEquip)
            {
                lbxBlockEquip.Items.Add((lbxBlockEquip.Items.Count + 1) + "." + beq.TypeEquip + beq.Title);
            }
        }
        public void OnShowResult()
        {
            var unit = this.GetSelectedUnits().FirstOrDefault();

            if (unit == null)
            {
                return;
            }
            var results = this.ClientApp.Service.GetSubResults(unit.PhoneNumberId, eTaskType.CTT);

            ConfigServices.ShowResults(results, eTaskType.CTT, unit.Name);
        }
예제 #4
0
        //выбор схемы
        private void cboShema_SelectionChangeCommitted(object sender, EventArgs e)
        {
            _schema        = cboShema.SelectedItem as Schema;
            txtResult.Text = BuildBlockName(txtResult.Text, 16, _schema.Indexx);

            if (_currentBreaker != null)
            {
                cboSize.Enabled       = true;
                cboSize.DataSource    = ConfigServices.GetAllVertSizes(_currentBreaker, _schema);
                cboSize.ValueMember   = "Id";
                cboSize.DisplayMember = "SizeName";
                cboSize.ResetText();
            }
        }
예제 #5
0
        //добавление элемента DragDrop
        private void listBox1_DragDrop(object sender, DragEventArgs e)
        {
            lbxBlockEquip.Items.Add((lbxBlockEquip.Items.Count + 1) + "." + typeEquip[0] + e.Data.GetData(DataFormats.Text));
            object data = e.Data.GetData(DataFormats.StringFormat);

            #region Оборудование
            if (_currentBreaker != null)
            {
                #region /*связанные трансфмораторы тока*/
                foreach (ProjectCtr pctr in ConfigServices.GetBindedCurTrans(_currentBreaker))
                {
                    pctr.Title = ConfigServices.GetCtrTitile(pctr);
                    listBlockEquip.Add(new BlockEquipment()
                    {
                        IdEquip = pctr.IdProjectEquip, TypeEquip = typeEquip[1], Title = pctr.Title
                    });
                    lbxBlockEquip.Items.Add((lbxBlockEquip.Items.Count + 1) + "." + typeEquip[1] + pctr.Title);
                }
                #endregion

                #region /*связанный контактор*/
                ProjectCnt pcnt = ConfigServices.GetBindedCont(_currentBreaker);
                if (pcnt != null)
                {
                    pcnt.Title = ConfigServices.GetCntTitle(pcnt);
                    if (pcnt.Title.Contains("нет"))
                    {
                        pcnt.Title = pcnt.Title.Replace("+ реле нет", "");
                    }
                    listBlockEquip.Add(new BlockEquipment()
                    {
                        IdEquip = pcnt.IdProjectEquip, TypeEquip = typeEquip[2], Title = pcnt.Title
                    });
                    lbxBlockEquip.Items.Add((lbxBlockEquip.Items.Count + 1) + "." + typeEquip[2] + pcnt.Title);
                }
                #endregion

                listBlockEquip.Add(new BlockEquipment()
                {
                    IdEquip = _currentBreaker.IdProjectEquip, TypeEquip = typeEquip[0], Title = _currentBreaker.Title
                });
            }
            #endregion

            txtResult.Text = BuildBlockName(txtResult.Text, 19, ConfigServices.GetManufLiter(_currentBreaker));
            txtFeeder.Text = _currentBreaker.ConNum;                  //наименование присоединения

            dgvProjectCbr.Rows.Remove(dgvProjectCbr.SelectedRows[0]); //убрать из списка добавленный автомат
            cboShema.Enabled = true;
        }
예제 #6
0
        private void AddItem()
        {
            var vm = ConfigServices.ShowContact(this.App, null, true);

            if (vm == null)
            {
                return;
            }
            var list    = vm.GetSelectedItems();
            var dupList = new List <ContactItemViewModel>();

            foreach (var c in list)
            {
                if (this.Details.Any(d => d.UnitName == c.UnitName && d.PhoneNumber == c.Phone.Number))
                {
                    dupList.Add(c);
                }
                else
                {
                    var obj = new ContactInGroup();
                    obj.Contact = c.Phone;
                    if (Details.Count > 0)
                    {
                        obj.ListOrder = Details.Max(d => d.ListOrder) + 1;
                    }
                    else
                    {
                        obj.ListOrder = 1;
                    }
                    GroupObj.Contacts.Add(obj);
                    var ivm = new GroupItemViewModel(obj);
                    ivm.PhoneNumber = c.Number;
                    ivm.UnitName    = c.UnitName;
                    Details.Add(ivm);
                }
            }

            if (dupList.Count > 0)
            {
                var sb = new StringBuilder();
                sb.AppendLine("Các đơn vị bị trùng, không thêm vào:");
                foreach (var item in dupList)
                {
                    sb.AppendLine(string.Format("Đơn vị: {0}, số điện thoại: {1}", item.UnitName, item.Phone.Number));
                }
                GetService <IMessageBoxService>().ShowError(sb.ToString());
            }
        }
예제 #7
0
        //загрузка формы
        private void frmConfigurator_Load(object sender, EventArgs e)
        {
            using (frmInputBox frm = new frmInputBox(1 /*введите номер проекта*/))
            {
                if (frm.ShowDialog() == DialogResult.Yes)
                {
                    Project pr = ProjectServices.GetByNumber(frm.GetTxtValue);

                    if (pr != null)
                    {
                        _project = pr;
                    }
                }
            }

            rbtnGeneral.Checked = true;
            _blockNameMask      = txtResult.Text;

            bs_ProjectCbr.DataSource = ConfigServices.GetProjectCbr(_project, false);

            bs_cbrCCbrPrj.DataSource  = EquipServices.GetAllCbCur();
            bs_disCCbrPrj.DataSource  = EquipServices.GetAllDisCur();
            bs_disMCbrPrj.DataSource  = EquipServices.GetAllDisModel();
            bs_icuLCbrPrj.DataSource  = EquipServices.GetAllIcuLiteral();
            bs_seriaCbrPrj.DataSource = EquipServices.GetAllSeria();

            bs_Schema.DataSource     = ConfigServices.GetAllSchema();
            bs_BaseHeight.DataSource = ConfigServices.GetBaseSizes("H");
            bs_BaseWidth.DataSource  = ConfigServices.GetBaseSizes("B");

            foreach (Control ctr in this.Controls)
            {
                if (ctr.GetType() == typeof(ComboBox))
                {
                    ctr.ResetText();
                }
            }

            if (_project.IdNumber != 0)
            {
                tsProjectNumber.Text = ProjectServices.GetProjectNumber(_project);
            }
            else
            {
                tsProjectNumber.Text = "тестовый проект";
            }
        }
예제 #8
0
 //удаление ошибочно добавленного выключателя
 private void listBox_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Delete)
     {
         if (lbxBlockEquip.SelectedItem.ToString().Contains(typeEquip[0] /*выключатель*/))
         {
             bs_ProjectCbr.DataSource = ConfigServices.GetProjectCbr(_project, false);
             ResetForm("cbrDelete");
         }
         listBlockEquip.RemoveAt(lbxBlockEquip.SelectedIndex);
         lbxBlockEquip.Items.Remove(lbxBlockEquip.SelectedItem);
         if (lbxBlockEquip.Items.Count > 0)
         {
             lbxBlockEquip.SetSelected(lbxBlockEquip.Items.Count - 1, true);
         }
     }
 }
예제 #9
0
        public void Start()
        {
            lock (_lockObject)
            {
                if (_started)
                {
                    return;
                }
                _started = true;

                HostingEnvironment.RegisterObject(this);

                GlobalConfiguration.Configuration.UseSqlServerStorage(ConfigServices.GetConnectionString());

                _backgroundJobServer = new BackgroundJobServer();
            }
        }
예제 #10
0
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers();

            services.AddAuthentication("OAuth_2.0")
            .AddJwtBearer("JWT", config => {
                config.RequireHttpsMetadata = false;

                config.TokenValidationParameters = new TokenValidationParameters
                {
                    ValidateIssuer           = true,
                    ValidIssuer              = JWT_Options.ISSUER,
                    ValidateAudience         = true,
                    ValidAudience            = JWT_Options.AUDIENCE,
                    ValidateIssuerSigningKey = true,
                    IssuerSigningKey         = JWT_Options.GetSymmetricSecurityKey()
                };
            });

            services.AddSingleton <IHttpContextAccessor, HttpContextAccessor>();

            var mapperConfig = new MapperConfiguration(cfg =>
            {
                ConfigMapper.Init(cfg);
                MapperConfig.Init(cfg);
            });

            mapperConfig.CompileMappings();

            var mapper = new Mapper(mapperConfig);

            ConfigServices.BuildConfig(services, Configuration.GetConnectionString("DefaultConnection"));

            services.AddSingleton <IMapper>(mapperConfig.CreateMapper());

            services.AddScoped <ICarService, CarService>();
            services.AddScoped <ICarClassService, CarClassService>();
            services.AddScoped <ICompanyService, CompanyService>();
            services.AddScoped <IOrderService, OrderService>();
            services.AddScoped <IImageService, ImageService>();
            services.AddScoped <ICustomerService, CustomerService>();
        }
        public void ConfigureServices(IServiceCollection services)
        {
            #region Register DB Context
            ConfigDbContext.Register(Configuration, services);
            #endregion

            #region CORS
            var allowedCors = Configuration.GetSection("CORS")
                              .AsEnumerable()
                              .Where(h => !string.IsNullOrEmpty(h.Value))
                              .Select(h => h.Value).ToArray();

            services.AddCors(options =>
            {
                options.AddPolicy(_allowOriginPolicy,
                                  builder =>
                {
                    builder.WithOrigins(allowedCors)
                    .SetIsOriginAllowedToAllowWildcardSubdomains()
                    .AllowAnyHeader()
                    .AllowAnyMethod()
                    .AllowCredentials();
                });
            });
            #endregion

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_3_0)
            .AddNewtonsoftJson(options => options.SerializerSettings.ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Ignore);

            services.AddSwaggerServices();

            services.AddControllers()
            .AddJsonOptions(options => options.JsonSerializerOptions.PropertyNamingPolicy = null);


            #region Register Application Services
            ConfigServices.Register(services);
            #endregion
        }
예제 #12
0
        /* [ Добавить ] */
        private void btnNext_Click(object sender, EventArgs e)
        {
            int[] blockParams = { _height.Id, _width.Id, _verticalSize.Id, _schema.Id, (int)_project.IdNumber };

            int idBlock = ConfigServices.InsertBlock(txtResult.Text, _functional, blockParams, listBlockEquip);

            if (idBlock > 0)
            {
                MessageBox.Show("Блок успешно добавлен в проект", "Информация", MessageBoxButtons.OK, MessageBoxIcon.Information);
                tsBlockCount.Text = ConfigServices.BlockCount(_project).ToString();

                dictBlockDgvRow.Add(dgvProjectBlock.Rows.Add("", txtFeeder.Text, txtResult.Text, ""), idBlock);
                tsBlockCount.Text = dgvProjectBlock.Rows.Count.ToString();

                ResetForm(string.Empty);
            }
            else
            {
                MessageBox.Show("Ошибка добавления записи в базу данных.\n\r" +
                                "Обратитесь в техническую поддержку");
            }
        }
예제 #13
0
        private void OnViewResult()
        {
            var results = this.Controller.ClientApp.Service.GetResults(this.TaskType);

            ConfigServices.ShowResults(results, this.TaskType, this.Controller.ClientApp.OfficeName);
        }
예제 #14
0
 public ClientBase() : base(ConfigServices.GetServiceEndpoint(typeof(TChannel)))
 {
 }
 public ConfigController(ILogger <ConfigController> logger, ConfigServices configService)
 {
     _logger        = logger;
     _configService = configService;
 }
예제 #16
0
        public object BeforeSendRequest(ref System.ServiceModel.Channels.Message request, System.ServiceModel.IClientChannel channel)
        {
            HttpRequestMessageProperty httpRequestMessage;
            object        httpRequestMessageObject;
            string        cookieValue = "";
            List <Cookie> CookieList  = new List <Cookie>();

            cookieValue = ConfigServices.GetConfig().AppSettings.Settings["COOKIE_SERVICE_TYPE"].Value;

            if (request.Properties.TryGetValue(HttpRequestMessageProperty.Name, out httpRequestMessageObject))
            {
                httpRequestMessage = httpRequestMessageObject as HttpRequestMessageProperty;
                if (string.IsNullOrEmpty(httpRequestMessage.Headers["Cookie"]))
                {
                    if (cookieValue == "1")
                    {
                        SAMLService samlService = new SAMLService();
                        if (CookieList.Count == 0)
                        {
                            CookieList = samlService.GetSAMLCookieForUri(endPointAddress);
                        }
                        for (int i = 0; i < CookieList.Count; i++)
                        {
                            if (CookieList[i].Name.Contains("shib"))
                            {
                                string shibCookie = CookieList[i].Name + "=" + CookieList[i].Value;
                                httpRequestMessage.Headers["Cookie"] = shibCookie;
                            }
                        }
                    }
                    else if (cookieValue == "0")
                    {
                        string smCookie = WebCookieServices.GetSmCookieForUri(endPointAddress, this.contractName);
                        httpRequestMessage.Headers["Cookie"] = smCookie;
                    }
                    else
                    {
                        return(null);
                    }
                }
            }
            else
            {
                if (cookieValue == "1")
                {
                    SAMLService samlService = new SAMLService();
                    httpRequestMessage = new HttpRequestMessageProperty();
                    if (CookieList.Count == 0)
                    {
                        CookieList = samlService.GetSAMLCookieForUri(endPointAddress);
                    }
                    for (int i = 0; i < CookieList.Count; i++)
                    {
                        if (CookieList[i].Name.Contains("shib"))
                        {
                            string shibCookie = CookieList[i].Name + "=" + CookieList[i].Value;
                            httpRequestMessage.Headers["Cookie"] = shibCookie;
                        }
                    }
                    httpRequestMessage = new HttpRequestMessageProperty();
                    request.Properties.Add(httpRequestMessageProperty.Name, httpRequestMessage);
                }
                else if (cookieValue == "0")
                {
                    string smCookie = WebCookieServices.GetSmCookieForUri(endPointAddress, this.contractName);
                    HttpRequestMessageProperty httpRequestMessage = new HttpRequestMessageProperty();
                    httpRequestMessage.Headers["Cookie"] = smCookie;
                    request.Properties.Add(httpRequestMessageProperty.Name, httpRequestMessage);
                }
                else
                {
                    return(null);
                }
            }
            return(null);
        }
예제 #17
0
 /// <summary>
 /// constructor padrão que pega a connection string dinamicamente de um serviço que a cria e configura um initializer com migrations
 /// </summary>
 public TPAContext() : base(ConfigServices.GetConnectionString())
 {
     Database.SetInitializer <TPAContext>(new MigrateDatabaseToLatestVersion <TPAContext, TPA.Infra.Migrations.Configuration>());
     //Database.SetInitializer<TPAContext>(null);
 }
예제 #18
0
 /// <summary>
 /// verifica se o ambiente que está rodando é o de produção ou de desenvolvimento
 /// </summary>
 /// <returns></returns>
 public static bool IsDevEnv()
 {
     //mssql04-farm68.kinghost.net;
     return(!ConfigServices.GetConnectionString().Contains("mssql04-farm68.kinghost.net"));
 }