private void btnImportCSV_AdminValuesDefault_Click(object sender, EventArgs e) { int days = (m_admin.m_curDate.Date - HAdmin.ToMoscowTimeZone(DateTime.Now).Date).Days; if (days < 0) { string strMsg = string.Format(@"Выбрана дата ретроспективных данных: {0}.", m_admin.m_curDate.Date.ToString(@"dd.MM.yyyy")); MessageBox.Show(this, strMsg, @"Внимание", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } else { OpenFileDialog files = new OpenFileDialog(); files.Multiselect = false; //files.InitialDirectory = Environment.GetFolderPath (Environment.SpecialFolder.Desktop); files.InitialDirectory = FormMain.formParameters.m_arParametrSetup [(int)FormParameters.PARAMETR_SETUP.KOMDISP_FOLDER_CSV]; //@"\\ne2844\2.X.X\ПБР-csv"; //@"E:\Temp\ПБР-csv"; files.DefaultExt = @"csv"; files.Filter = @"Рекомендации-по-умолчанию (AdminValuesDefault.csv)|AdminValuesDefault.csv"; files.Title = "Выберите файл со рекомендациями по умолчанию..."; int iRes = -1; if (files.ShowDialog(FormMain.formParameters) == DialogResult.OK) { if (days > 0) { iRes = 0; } else { if (days == 0) { string strMsg = string.Format(@"Рекомендации по умолчанию будут загружены на текущие сутки: {0}.{1}Продолжить?", m_admin.m_curDate.Date.ToString(@"dd.MM.yyyy"), Environment.NewLine); if (MessageBox.Show(this, strMsg, @"Подтверждение", MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes) { iRes = 0; } else { ; //По-прежнему ошибка... } } else { ; } } if (iRes == 0) { ((AdminTS_KomDisp)m_admin).ImpCSVValues(mcldrDate.SelectionStart, files.FileName); } else { ; } } else { } } }
public override void Fill(params object [] pars) { int count = (int)pars[1] , hour = -1 , offset = -1 , i = -1, c = -1; DateTime dtCurrent = (DateTime)pars[0]; bool bSeasonDate = (bool)pars[2]; Rows.Clear(); //Rows.Add(count + 1); RowsAdd(); for (i = 0; i < count; i++) { hour = i + 1; if (bSeasonDate == true) { offset = HAdmin.GetSeasonHourOffset(dtCurrent, hour); Rows[i].Cells[(int)INDEX_COLUMNS.PART_TIME].Value = (hour - offset).ToString(); if ((hour - 1) == HAdmin.SeasonDateTime.Hour) { Rows[i].Cells[0].Value += @"*"; } else { ; } } else { Rows[i].Cells[(int)INDEX_COLUMNS.PART_TIME].Value = (hour).ToString(); } for (c = 1; c < m_arColumns.Length; c++) { Rows[i].Cells[c].Value = 0.ToString("F2"); } } Rows[count].Cells[0].Value = "Сумма"; for (c = 1; c < m_arColumns.Length; c++) { switch ((INDEX_COLUMNS)c) { case INDEX_COLUMNS.PBR: case INDEX_COLUMNS.PBRe: Rows[i].Cells[c].Value = @"-".ToString(); break; default: Rows[i].Cells[c].Value = 0.ToString("F2"); break; } } }
public void Test_GetPBRNumber() { int err = -1 , iRes = -1; ; string [] input = { "" , $"{StatisticCommon.HAdmin.PBR_PREFIX}" , $"П{HAdmin.PBR_PREFIX}" , $"ПП{HAdmin.PBR_PREFIX}89" , $"ПП12{HAdmin.PBR_PREFIX}" , $"П{HAdmin.PBR_PREFIX}-1" , $"{HAdmin.PBR_PREFIX}2" , $"-4{HAdmin.PBR_PREFIX}" , $"{HAdmin.PBR_PREFIX}24" }; int [] expected_err = { -1 , -1 , 1 , -1 , -1 , -1 , 0 , -1 , 0 }; int [] expected_ret = { -1 , -1 , 0 , 0 , 0 , 0 , 2 , 0 , 24 }; int [] actual = new int [expected_ret.Length]; for (int i = 0; i < input.Length; i++) { Assert.AreEqual(expected_ret [i], HAdmin.GetPBRNumber(input [i], out err)); Assert.AreEqual(expected_err [i], err); } }
public override void getCurRDGValues(HAdmin source) { m_listCurRDGValues = new List <RDGStruct[]>(); foreach (FormChangeMode.KeyDevice key in m_listKeyTECComponentDetail) { int j = m_listKeyTECComponentDetail.IndexOf(key); m_listCurRDGValues.Add(new RDGStruct[((AdminTS_NSS)source).m_listCurRDGValues[j].Length]); ((AdminTS_NSS)source).m_listCurRDGValues[j].CopyTo(m_listCurRDGValues[j], 0); } getCurTimezoneOffsetRDGExcelValues((AdminTransTG)source); }
public override void getCurRDGValues(HAdmin source) { m_listCurRDGValues = new List <RDGStruct[]>(); foreach (int indx in m_listTECComponentIndexDetail) { int j = m_listTECComponentIndexDetail.IndexOf(indx); m_listCurRDGValues.Add(new RDGStruct[((AdminTS_NSS)source).m_listCurRDGValues[j].Length]); ((AdminTS_NSS)source).m_listCurRDGValues[j].CopyTo(m_listCurRDGValues[j], 0); } getCurTimezoneOffsetRDGExcelValues((AdminTransTG)source); }
public override void getCurRDGValues(HAdmin source) { base.getCurRDGValues(source); for (int i = 0; i < source.m_curRDGValues.Length; i++) { m_curRDGValues[i].pbr = source.m_curRDGValues[i].pbr; m_curRDGValues[i].pmin = source.m_curRDGValues[i].pmin; m_curRDGValues[i].pmax = source.m_curRDGValues[i].pmax; m_curRDGValues[i].pbr_number = source.m_curRDGValues[i].pbr_number; m_curRDGValues[i].dtRecUpdate = source.m_curRDGValues[i].dtRecUpdate; } }
/// <summary> /// Обязательный метод для поддержки конструктора - не изменяйте /// содержимое данного метода при помощи редактора кода. /// </summary> private void InitializeComponent() { components = new System.ComponentModel.Container(); this.m_dtprDate = new DateTimePicker(); this.m_dtprDate.Dock = DockStyle.Fill; //this.m_dtprDate.ValueChanged += new EventHandler(((PanelLastMinutes)Parent).OnDateTimeValueChanged); m_dtprDate.Value = HAdmin.ToMoscowTimeZone(DateTime.Now); this.m_dtprDate.ValueChanged += new EventHandler(OnDateTimeValueChanged); this.m_btnUpdate = new Button(); this.m_btnUpdate.Dock = DockStyle.Fill; this.m_btnUpdate.Text = @"Обнов."; this.m_btnUpdate.Click += new EventHandler(OnDateTimeValueChanged); }
public ActionResult AddAdministrador(DtoAdm nuevoAdministrador) { bool msg = HAdmin.getInstace().AddAdministrador(nuevoAdministrador); if (msg == true) { TempData["Message"] = "Empleado registrado satisfactoriamente!"; } else { TempData["Message"] = "Completa todos los campos por favor!"; } return(RedirectToAction("RegistroAdm")); }
public ActionResult Login(DtoAdm dto) { bool existe = HAdmin.getInstace().ExisteEmpleado(dto); if (existe) { //Crea la Cookie para que el usuario sea autenticado FormsAuthentication.SetAuthCookie(dto.NombreUsuario, false); Session["NombreDeUsuario"] = dto.NombreUsuario; Session["Contraseña"] = dto.contraseña; return(Redirect("/Home")); } return(View()); }
public FormMainTransModes(ASUTP.Helper.ProgramBase.ID_APP id_app, KeyValuePair <string, string> [] config) : base(id_app , new System.Collections.Generic.KeyValuePair <string, string> [] { new System.Collections.Generic.KeyValuePair <string, string> (@"ИгнорДатаВремя-techsite", false.ToString()) }.Concat(config).ToArray()) { InitializeComponentTransModes(); //m_SetupINI = new SETUP_INI (); //??? this.m_dgwAdminTable = new StatisticTransModes.DataGridViewAdminModes(); ((System.ComponentModel.ISupportInitialize)(this.m_dgwAdminTable)).BeginInit(); // // m_dgwAdminTable // this.SuspendLayout(); this.m_dgwAdminTable.Location = new System.Drawing.Point(319, 5); this.m_dgwAdminTable.Name = "m_dgwAdminTable"; this.m_dgwAdminTable.RowHeadersVisible = false; this.m_dgwAdminTable.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; //this.m_dgwAdminTable.Size = new System.Drawing.Size(498, 401); this.m_dgwAdminTable.TabIndex = 27; this.panelMain.Controls.Add(this.m_dgwAdminTable); ((System.ComponentModel.ISupportInitialize)(this.m_dgwAdminTable)).EndInit(); this.ResumeLayout(false); //m_listIsDataTECComponents = new List<bool>(); m_dgwAdminTable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)); m_modeTECComponent = FormChangeMode.MODE_TECCOMPONENT.GTP; m_arAdmin = new HAdmin[(Int16)CONN_SETT_TYPE.COUNT_CONN_SETT_TYPE]; Start(); }
public FormMainTransModes(int id_app) : base(id_app , new string[] { @"ИгнорДатаВремя-techsite" /*, @"РДГФорматТаблицаНазначение", @"ТипБДКфгНазначение"*/ } , new string[] { false.ToString() /*, AdminTS.TYPE_FIELDS.DYNAMIC.ToString(), @"200"*/ }) { InitializeComponentTransModes(); //m_SetupINI = new SETUP_INI (); //??? this.m_dgwAdminTable = new StatisticTransModes.DataGridViewAdminModes(); ((System.ComponentModel.ISupportInitialize)(this.m_dgwAdminTable)).BeginInit(); // // m_dgwAdminTable // this.SuspendLayout(); this.m_dgwAdminTable.Location = new System.Drawing.Point(319, 5); this.m_dgwAdminTable.Name = "m_dgwAdminTable"; this.m_dgwAdminTable.RowHeadersVisible = false; this.m_dgwAdminTable.RowTemplate.Resizable = System.Windows.Forms.DataGridViewTriState.False; //this.m_dgwAdminTable.Size = new System.Drawing.Size(498, 401); this.m_dgwAdminTable.TabIndex = 27; this.panelMain.Controls.Add(this.m_dgwAdminTable); ((System.ComponentModel.ISupportInitialize)(this.m_dgwAdminTable)).EndInit(); this.ResumeLayout(false); //m_listIsDataTECComponents = new List<bool>(); m_dgwAdminTable.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left)); m_modeTECComponent = FormChangeMode.MODE_TECCOMPONENT.GTP; m_arAdmin = new HAdmin[(Int16)CONN_SETT_TYPE.COUNT_CONN_SETT_TYPE]; Start(); }