private void Comb_AdminTargetsComboBoxChange_SelectedItemChange(object sender, EventArgs e) { DataTable Targets = new DataTable(); DataRow TargetsRow; decimal Year = Num_AdminTargetsYear.Value; int SelectedIndex = Comb_AdminTargetsRewizja.SelectedIndex; Data_Import.Singleton().Load_TxtToDataTable2(ref Targets, "Kurs"); Tb_AdminTargetsDM.Text = ""; Tb_AdminTargetsPercent.Text = ""; Tb_AdminTargetsElePercent.Text = ""; Tb_AdminTargetsMechPercent.Text = ""; Tb_AdminTargetsNVRPercent.Text = ""; TargetsRow = Targets.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).First(); if (TargetsRow != null) { string[] DM = (TargetsRow["DM"].ToString()).Split('/'); string[] PC = (TargetsRow["PC"].ToString()).Split('/'); string[] Ele = (TargetsRow["Ele"].ToString()).Split('/'); string[] Mech = (TargetsRow["Mech"].ToString()).Split('/'); string[] NVR = (TargetsRow["NVR"].ToString()).Split('/'); Tb_AdminTargetsDM.Text = DM[SelectedIndex]; Tb_AdminTargetsPercent.Text = PC[SelectedIndex]; Tb_AdminTargetsElePercent.Text = Ele[SelectedIndex]; Tb_AdminTargetsMechPercent.Text = Mech[SelectedIndex]; Tb_AdminTargetsNVRPercent.Text = NVR[SelectedIndex]; } }
private void LoadData() { DataTable AllData = new DataTable(); DataRow[] ProjectRows; DataRow SpecyficPNC; Data_Import.Singleton().Load_TxtToDataTable2(ref AllData, "PlatformPNCList"); ProjectRows = AllData.Select(string.Format("Project LIKE '%{0}%'", _project)).ToArray(); SpecyficPNC = AllData.NewRow(); foreach (DataRow Row in ProjectRows) { if (Row["NewPNC"].ToString() == _newPNC) { if (Row["OldPNC"].ToString() == _oldPNC) { SpecyficPNC.ItemArray = (object[])Row.ItemArray.Clone(); break; } } } if (SpecyficPNC == null) { return; } LoadSpecificationToLabel(SpecyficPNC); }
public NewAccount(TextBox BIZ) { DataTable Access = new DataTable(); DataRow NewAccount; Data_Import.Singleton().Load_TxtToDataTable2(ref Access, "Access"); NewAccount = Access.NewRow(); NewAccount["Name"] = BIZ.Text; NewAccount["FullName"] = ""; NewAccount["Mail"] = ""; NewAccount["Role"] = "Employee"; NewAccount["tab_Action"] = "false"; NewAccount["Action"] = "false"; NewAccount["ActionEle"] = "false"; NewAccount["ActionMech"] = "false"; NewAccount["ActionNVR"] = "false"; NewAccount["tab_Summary"] = "false"; NewAccount["tab_STK"] = "false"; NewAccount["tab_Quantity"] = "false"; NewAccount["tab_Admin"] = "false"; NewAccount["EleApprove"] = "false"; NewAccount["MechApprove"] = "false"; NewAccount["NVRApprove"] = "false"; NewAccount["PCApprove"] = "false"; Access.Rows.Add(NewAccount); Data_Import.Singleton().Save_DataTableToTXT2(ref Access, "Access"); }
public void SumPlanTable() { DataTable Kurs = new DataTable(); DataRow KursRow; decimal Year; Year = MainProgram.Self.sdOptions1.GetYear(); Data_Import.Singleton().Load_TxtToDataTable2(ref Kurs, "Kurs"); KursRow = Kurs.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).FirstOrDefault(); //Czyszczenie tablicy CleanSummTabel(); //Sumowanie wartości z Actuala, CarryOver i ECCC dgv_SumPlan.Rows[0].Cells[0].Value = PlanTableSum(0); dgv_SumPlan.Rows[1].Cells[0].Value = PlanTableSum(1); dgv_SumPlan.Rows[2].Cells[0].Value = PlanTableSum(2); dgv_SumPlan.Rows[3].Cells[0].Value = PlanTableSum(3); dgv_SumPlan.Rows[4].Cells[0].Value = PlanTableSum(4); //Wyliczenie Procentów dostarczonych PercentWykonania(); //Wyliczenie ile już dostarczyliśmy DM DMForRewizion(KursRow); //Wpisanie targetów TargetsSum(KursRow); //Delta DeltaSumm(); }
public SentTo(bool ElectronicMenager, bool MechanicMenager, bool NVRMenager, bool PCMenager) { _Import = Data_Import.Singleton(); _Electronic = ElectronicMenager; _Mechanic = MechanicMenager; _NVR = NVRMenager; _PC = PCMenager; }
private void LoadToTable() { DataTable Actions = new DataTable(); string[] Klucz; string ActionKey; int StartMonth; string Revision; DataGridView Actual = (DataGridView)MainProgram.Self.TabControl.Controls.Find("gd_ActualAction", true).First(); DataGridView CarryOver = (DataGridView)MainProgram.Self.TabControl.Controls.Find("gd_CarryOverAction", true).First(); decimal Year = ((NumericUpDown)MainProgram.Self.TabControl.Controls.Find("num_SummaryDetailYear", true).First()).Value; CheckBox Active = (CheckBox)MainProgram.Self.TabControl.Controls.Find("CB_Active1", true).First(); CheckBox Idea = (CheckBox)MainProgram.Self.TabControl.Controls.Find("CB_Idea1", true).First(); ComboBox Leader = (ComboBox)MainProgram.Self.TabControl.Controls.Find("Comb_SummDetLeader", true).First(); ComboBox Devision = (ComboBox)MainProgram.Self.TabControl.Controls.Find("Comb_SummDetDevision", true).First(); CheckBox Savings = (CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_SDOptionSavings", true).First(); CheckBox Quantity = (CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_SDOptionQuantity", true).First(); CheckBox ECCC = (CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_SDOptionECCC", true).First(); CheckBox Positive = (CheckBox)MainProgram.Self.TabControl.Controls.Find("CB_Positive1", true).First(); CheckBox Negative = (CheckBox)MainProgram.Self.TabControl.Controls.Find("CB_Negative1", true).First(); Actual.Rows.Clear(); CarryOver.Rows.Clear(); Data_Import.Singleton().Load_TxtToDataTable2(ref Actions, "Action"); StartMonth = WhatCanBePresented(Year); Revision = WhatRevisionApprove(Year); //Tworzenie kluczy Klucz = CreateKey(Active.Checked, Idea.Checked, Year, Leader.Text, Devision.Text, Positive.Checked, Negative.Checked); foreach (DataRow ActionRow in Actions.Rows) { ActionKey = CreateActionKey(ActionRow, Active.Checked, Idea.Checked, Devision.Text, Leader.Text, Positive.Checked, Negative.Checked, Year); if (Klucz[0] == ActionKey || Klucz[1] == ActionKey || Klucz[2] == ActionKey) { LoadActionSD(ActionRow, false, Savings.Checked, Quantity.Checked, ECCC.Checked, StartMonth, Revision); } else if (Klucz[3] == ActionKey) { LoadActionSD(ActionRow, true, Savings.Checked, Quantity.Checked, ECCC.Checked, StartMonth, Revision); } } DataGridView Table = (DataGridView)MainProgram.Self.TabControl.Controls.Find("gd_CarryOverAction", true).First(); Table.Columns["Name"].DefaultCellStyle.BackColor = Color.FromArgb(252, 228, 214); Table.Columns["Option"].DefaultCellStyle.BackColor = Color.White; Table.Columns["Sum"].DefaultCellStyle.BackColor = Color.FromArgb(244, 176, 132); Table = (DataGridView)MainProgram.Self.TabControl.Controls.Find("gd_ActualAction", true).First(); Table.Columns["Name"].DefaultCellStyle.BackColor = Color.FromArgb(252, 228, 214); Table.Columns["Option"].DefaultCellStyle.BackColor = Color.White; Table.Columns["Sum"].DefaultCellStyle.BackColor = Color.FromArgb(244, 176, 132); }
public LoadAccess(ComboBox AllPerson) { DataTable Access = new DataTable(); Data_Import.Singleton().Load_TxtToDataTable2(ref Access, "Access"); AllPerson.Items.Clear(); AllPerson.Text = ""; foreach (DataRow Row in Access.Rows) { AllPerson.Items.Add(Row["Name"]); } }
public void PlanTable() { DataTable Kurs = new DataTable(); DataRow KursRow; decimal Year; Year = MainProgram.Self.sdOptions1.GetYear(); Data_Import.Singleton().Load_TxtToDataTable2(ref Kurs, "Kurs"); KursRow = Kurs.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).FirstOrDefault(); PlanTableCheck(dgv_SavingSum, dgv_PlanActual, KursRow); PlanTableCheck(dgv_CarryOverSum, dgv_PlanCarryOver, KursRow); PlanTableCheck(dgv_ECCCSum, dgv_PlanECCC, KursRow); }
public DeleteAccount(TextBox BIZ) { DataTable Account = new DataTable(); DataRow FoundRow; Data_Import.Singleton().Load_TxtToDataTable2(ref Account, "Access"); FoundRow = Account.Select(string.Format("Name LIKE '%{0}%'", BIZ.Text)).FirstOrDefault(); if (FoundRow != null) { Account.Rows.Remove(FoundRow); } Data_Import.Singleton().Save_DataTableToTXT(ref Account, "Access"); }
private void TargetsLoad() { DataTable Targets = new DataTable(); DataRow TargetsRow; int Revision = 5; Data_Import.Singleton().Load_TxtToDataTable2(ref Targets, "Kurs"); TargetsRow = Targets.Select(string.Format("Year LIKE '%{0}%'", _Year.ToString())).First(); if (TargetsRow != null) { string[] DM = (TargetsRow["DM"].ToString()).Split('/'); string[] PC = (TargetsRow["PC"].ToString()).Split('/'); string[] Ele = (TargetsRow["Ele"].ToString()).Split('/'); string[] Mech = (TargetsRow["Mech"].ToString()).Split('/'); string[] NVR = (TargetsRow["NVR"].ToString()).Split('/'); for (int counter = 4; counter >= 0; counter--) { if (DM[counter] != "") { Revision = counter; break; } } if (Revision != 5) { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Comb_AdminTargetsRewizja", true).First()).SelectedIndex = Revision; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsDM", true).First()).Text = DM[Revision]; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsPercent", true).First()).Text = PC[Revision]; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsElePercent", true).First()).Text = Ele[Revision]; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsMechPercent", true).First()).Text = Mech[Revision]; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsNVRPercent", true).First()).Text = NVR[Revision]; } } if (Revision == 5) { ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsPercent", true).First()).Text = ""; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsElePercent", true).First()).Text = ""; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsMechPercent", true).First()).Text = ""; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsNVRPercent", true).First()).Text = ""; ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Comb_AdminTargetsRewizja", true).First()).SelectedIndex = 0; ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsDM", true).First()).Text = ""; } }
private string WhatRevisionApprove(decimal Year) { DataTable Frozen = new DataTable(); DataRow FrozenYear; string Revision = ""; Data_Import.Singleton().Load_TxtToDataTable2(ref Frozen, "Frozen"); FrozenYear = Frozen.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).First(); if (Year < DateTime.UtcNow.Year) { Revision = "USE"; } else if (Year > DateTime.UtcNow.Year) { if (FrozenYear["BU"].ToString() == "Approve" || FrozenYear["BU"].ToString() == "Open" || FrozenYear["BU"].ToString() == "Close") { Revision = "BU"; } else { Revision = ""; } } else { if (FrozenYear["BU"].ToString() == "Approve" || FrozenYear["BU"].ToString() == "Open") { Revision = "BU"; } if (FrozenYear["EA1"].ToString() == "Approve" || FrozenYear["EA1"].ToString() == "Open") { Revision = "EA1"; } if (FrozenYear["EA2"].ToString() == "Approve" || FrozenYear["EA2"].ToString() == "Open") { Revision = "EA2"; } if (FrozenYear["EA3"].ToString() == "Approve" || FrozenYear["EA3"].ToString() == "Open") { Revision = "EA3"; } } return(Revision); }
private void LoadComboBox() { DataTable ProjectList = new DataTable(); DataRow[] ProjectYear; Data_Import.Singleton().Load_TxtToDataTable2(ref ProjectList, "PlatformList"); ProjectYear = ProjectList.Select(string.Format("StartYear LIKE '%{0}%'", _year.Value.ToString())).ToArray(); if (ProjectYear != null) { foreach (DataRow Row in ProjectYear) { _project.Items.Add(Row["Project"].ToString()); } } }
private void Load() { DataTable Access = new DataTable(); Data_Import.Singleton().Load_TxtToDataTable2(ref Access, "Access"); if (_AddAll) { _ActionLeader.Items.Add("All"); } if (Users.Singleton.Role != "PCMenager") { _ActionLeader.Items.Add(Users.Singleton.Name); } foreach (DataRow AccessRow in Access.Rows) { if (AccessRow["Name"].ToString() != Users.Singleton.Name) { if (Users.Singleton.Role == "Admin" || Users.Singleton.Role == "PCMenager") { if (Users.Singleton.Name != AccessRow["FullName"].ToString()) { _ActionLeader.Items.Add(AccessRow["FullName"].ToString()); } else if (Users.Singleton.Role == "EleMenager" && AccessRow["ActionEle"].ToString() == "true" && AccessRow["Role"].ToString() != "PCMenager") { _ActionLeader.Items.Add(AccessRow["FullName"].ToString()); } else if (Users.Singleton.Role == "MechMenager" && AccessRow["ActionMech"].ToString() == "true" && AccessRow["Role"].ToString() != "PCMenager") { _ActionLeader.Items.Add(AccessRow["FullName"].ToString()); } else if (Users.Singleton.Role == "NVRMenager" && AccessRow["ActionNVR"].ToString() == "true" && AccessRow["Role"].ToString() != "PCMenager") { _ActionLeader.Items.Add(AccessRow["FullName"].ToString()); } } } } _ActionLeader.SelectedIndex = 0; }
private void LoadPNCToTree() { DataTable PNCTable = new DataTable(); DataRow[] ProjectPNC; Data_Import.Singleton().Load_TxtToDataTable2(ref PNCTable, "PlatformPNCList"); ProjectPNC = PNCTable.Select(string.Format("Project LIKE '%{0}%'", _project.SelectedItem.ToString())).ToArray(); AddTreeNodes(_project.SelectedItem.ToString()); if (ProjectPNC != null) { foreach (DataRow Row in ProjectPNC) { string PNCtoAdd = Row["NewPNC"].ToString() + " (" + Row["OldPNC"].ToString() + ")"; AddToTreeNodes(_project.SelectedItem.ToString(), PNCtoAdd); } } }
private decimal Load_ECCCKurs(string StartYear) { decimal Kurs = 0; DataTable AllKursy = new DataTable(); DataRow KursyYear; if (StartYear.Length != 4) { StartYear = StartYear.Remove(0, 3); } Data_Import.Singleton().Load_TxtToDataTable2(ref AllKursy, "Kurs"); KursyYear = AllKursy.Select(string.Format("Year LIKE '%{0}%'", StartYear)).FirstOrDefault(); if (KursyYear != null) { if (KursyYear["ECCC"] != null && KursyYear["ECCC"].ToString() != "") { Kurs = decimal.Parse(KursyYear["ECCC"].ToString()); } } return(Kurs); }
private int WhatCanBePresented(decimal Year) { //Wartości od 1 do 12 - miesiąc w aktualnym roku; //Wartość 0 - Poprzedni rok (tylko Actual) //Wartość -1 - Nastęny rok, tylko BU int StartMonth = -5; DataTable Frozen = new DataTable(); DataRow FrozenYear; Data_Import.Singleton().Load_TxtToDataTable2(ref Frozen, "Frozen"); if (Year < DateTime.UtcNow.Year) { StartMonth = 0; } else if (Year > DateTime.UtcNow.Year) { StartMonth = -1; } else { FrozenYear = Frozen.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).First(); for (int counter = 1; counter <= 12; counter++) { if (FrozenYear[counter.ToString()].ToString() == "Approve" || FrozenYear[counter.ToString()].ToString() == "Open") { StartMonth = counter; } } if (StartMonth == -5 && Year == DateTime.UtcNow.Year) { StartMonth = -1; } } return(StartMonth); }
public DataRow Load() { DataTable AllAction = new DataTable(); DataRow[] FoundRows; DataRow FoundRow; Data_Import.Singleton().Load_TxtToDataTable2(ref AllAction, "Action"); FoundRow = AllAction.NewRow(); FoundRows = AllAction.Select(string.Format("Name LIKE '%{0}%'", _ActionName)).ToArray(); foreach (DataRow Row in FoundRows) { if (Row["StartYear"].ToString() == _Year.ToString() || Row["StartYear"].ToString() == "SA/" + _Year.ToString()) { FoundRow.ItemArray = Row.ItemArray.Clone() as object[]; return(FoundRow); } } return(FoundRow); }
private void Save() { DataTable AllAction = new DataTable(); DataRow[] FoundRows; string[] AllString; string[] OnePNC; string[] SumQuantity; string[] SumSavings; decimal AllQuantity = 0; decimal AllSavings = 0; decimal AllECCC = 0; Data_Import.Singleton().Load_TxtToDataTable2(ref AllAction, "Action"); FoundRows = AllAction.Select(string.Format("Name LIKE '%{0}%'", _ActionName)).ToArray(); foreach (DataRow Row in FoundRows) { if (Row["StartYear"].ToString() == _Year.ToString() || Row["StartYear"].ToString() == "SA/" + _Year.ToString()) { if (_SingleAction) { Row["StartYear"] = "SA/" + _Year; } Row["Comment"] = _Comment; AllString = Row["PerUSE"].ToString().Split('/'); Row["PerUSE"] = ""; for (int counter = 0; counter < AllString.Length - 1; counter++) { OnePNC = AllString[counter].Split('|'); AllString[counter] = UpdateDataForTable(OnePNC); Row["PerUse"] += AllString[counter] + "/"; } SumQuantity = Row["CalcUseQuantity"].ToString().Split('/'); SumSavings = Row["CalcUSESaving"].ToString().Split('/'); Row["CalcUseQuantity"] = ""; Row["CalcUSESaving"] = ""; Row["CalcUSEECCC"] = ""; //Sumowanie wszystkiego do wyświetlania w akcji for (int counter = 1; counter <= 12; counter++) { if (_SumTable[counter.ToString(), 0].Value.ToString() != "" && _SumTable[counter.ToString(), 0].Value.ToString() != "0") { AllQuantity += decimal.Parse(_SumTable[counter.ToString(), 0].Value.ToString()); Row["CalcUseQuantity"] += _SumTable[counter.ToString(), 0].Value.ToString(); AllSavings += decimal.Parse(_SumTable[counter.ToString(), 1].Value.ToString()); Row["CalcUSESaving"] += Math.Round(decimal.Parse(_SumTable[counter.ToString(), 1].Value.ToString()), 0, MidpointRounding.AwayFromZero).ToString(); if (_SumTable[counter.ToString(), 1].Value.ToString() != "" && _SumTable[counter.ToString(), 1].Value.ToString() != "0") { AllECCC += decimal.Parse(_SumTable[counter.ToString(), 1].Value.ToString()); Row["CalcUSEECCC"] += Math.Round(decimal.Parse(_SumTable[counter.ToString(), 2].Value.ToString()), 0, MidpointRounding.AwayFromZero).ToString(); } } Row["CalcUseQuantity"] += "/"; Row["CalcUSESaving"] += "/"; Row["CalcUSEECCC"] += "/"; } Row["CalcUseQuantity"] += AllQuantity.ToString() + "/"; Row["CalcUSESaving"] += Math.Round(AllSavings, 0, MidpointRounding.AwayFromZero).ToString() + "/"; Row["CalcUSEECCC"] += Math.Round(AllECCC, 0, MidpointRounding.AwayFromZero).ToString() + "/"; } } Data_Import.Singleton().Save_DataTableToTXT2(ref AllAction, "Action"); }
public SaveAccess() { DataTable Access = new DataTable(); DataRow FoundRow; ComboBox cb_comBox_AdminAccess = (ComboBox)MainProgram.Self.TabControl.Controls.Find("comBox_AdminAccess", true).First(); Data_Import.Singleton().Load_TxtToDataTable2(ref Access, "Access"); if (cb_comBox_AdminAccess.Text != "") { FoundRow = Access.Select(string.Format("Name LIKE '%{0}%'", cb_comBox_AdminAccess.Text)).FirstOrDefault(); FoundRow["FullName"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminAccessFullName", true).First()).Text; FoundRow["Mail"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminAccess_Email", true).First()).Text; if (((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).Text == "Employee") { FoundRow["Role"] = "Employee"; } else if (((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).Text == "Electronic") { FoundRow["Role"] = "EleMenager"; } else if (((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).Text == "Mechanic") { FoundRow["Role"] = "MechMenager"; } else if (((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).Text == "NVR") { FoundRow["Role"] = "NVRMenager"; } else if (((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).Text == "PC") { FoundRow["Role"] = "PCMenager"; } else if (((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).Text == "Admin") { FoundRow["Role"] = "Admin"; } FoundRow["tab_Action"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabAction", true).First()).Checked.ToString().ToLower(); if (((RadioButton)MainProgram.Self.TabControl.Controls.Find("radbut_AdminViwer", true).First()).Checked) { FoundRow["Action"] = "View"; } else if (((RadioButton)MainProgram.Self.TabControl.Controls.Find("radbut_AdminDevelop", true).First()).Checked) { FoundRow["Action"] = "Developer"; } FoundRow["ActionEle"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminElectronic", true).First()).Checked.ToString().ToLower(); FoundRow["ActionMech"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminMechanic", true).First()).Checked.ToString().ToLower(); FoundRow["ActionNVR"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminNVR", true).First()).Checked.ToString().ToLower(); FoundRow["tab_Summary"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabSummary", true).First()).Checked.ToString().ToLower(); FoundRow["tab_Statistic"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabStatistic", true).First()).Checked.ToString().ToLower(); FoundRow["tab_Platform"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabPlatform", true).First()).Checked.ToString().ToLower(); FoundRow["tab_STK"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabSTK", true).First()).Checked.ToString().ToLower(); FoundRow["tab_Quantity"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabQuantity", true).First()).Checked.ToString().ToLower(); FoundRow["tab_Admin"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabAdmin", true).First()).Checked.ToString().ToLower(); FoundRow["EleApprove"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapEle", true).First()).Checked.ToString().ToLower(); FoundRow["MechApprove"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapMech", true).First()).Checked.ToString().ToLower(); FoundRow["NVRApprove"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapNVR", true).First()).Checked.ToString().ToLower(); FoundRow["PCApprove"] = ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapPC", true).First()).Checked.ToString().ToLower(); } else { return; } Data_Import.Singleton().Save_DataTableToTXT2(ref Access, "Access"); }
public void GrupingPNC_Month() { decimal All = 0; decimal DMD = 0; decimal D45 = 0; decimal DMD_FS = 0; decimal D45_FS = 0; decimal DMD_FI = 0; decimal D45_FI = 0; decimal DMD_BI = 0; decimal D45_BI = 0; decimal DMD_FSBU = 0; decimal D45_FSBU = 0; Data_Import.Singleton().Load_TxtToDataTable2(ref PNC, "PNCMonth"); Data_Import.Singleton().Load_TxtToDataTable2(ref SumPNC, "SumPNC"); if (!PNC.Columns.Contains(_Month.ToString() + "/" + _Year.ToString())) { MessageBox.Show("Missing Data for: " + _Month.ToString() + "/" + _Year.ToString(), "Attention!"); return; } if (SumPNC.Columns.Contains(_Month.ToString() + "/" + _Year.ToString())) { SumPNC.Columns.Remove(_Month.ToString() + "/" + _Year.ToString()); } SumPNC.Columns.Add(_Month.ToString() + "/" + _Year.ToString()); foreach (DataRow PNCRow in PNC.Rows) { if (PNCRow[_Month.ToString() + "/" + _Year.ToString()] != null && PNCRow[_Month.ToString() + "/" + _Year.ToString()].ToString() != "") { decimal Value = decimal.Parse(PNCRow[_Month.ToString() + "/" + _Year.ToString()].ToString()); string PNC = PNCRow["PNC"].ToString(); //Dodanie do sumy wszystkich PNC All += Value; //Rozbiecie na DMD i D45 if (PNC.Remove(0, 3).Remove(1, 5) == "5") { //Dodanie do Sumy DMD DMD += Value; //Sprawdzenie czy FS, FI, BI/BU lub FSBU switch (PNC.Remove(0, 4).Remove(1, 4)) { case "1": DMD_FS += Value; break; case "2": DMD_BI += Value; break; case "3": DMD_FI += Value; break; case "4": DMD_FSBU += Value; break; default: break; } } else { //Dodanie do Sumy D45 D45 += Value; switch (PNC.Remove(0, 4).Remove(1, 4)) { case "5": D45_FS += Value; break; case "6": D45_BI += Value; break; case "7": D45_FI += Value; break; case "8": D45_FSBU += Value; break; default: break; } } } } foreach (DataRow Row in SumPNC.Rows) { switch (Row["PNC"].ToString()) { case "All": Row[_Month.ToString() + "/" + _Year.ToString()] = All; break; case "DMD": Row[_Month.ToString() + "/" + _Year.ToString()] = DMD; break; case "D45": Row[_Month.ToString() + "/" + _Year.ToString()] = D45; break; case "DMD_FS": Row[_Month.ToString() + "/" + _Year.ToString()] = DMD_FS; break; case "D45_FS": Row[_Month.ToString() + "/" + _Year.ToString()] = D45_FS; break; case "DMD_FI": Row[_Month.ToString() + "/" + _Year.ToString()] = DMD_FI; break; case "D45_FI": Row[_Month.ToString() + "/" + _Year.ToString()] = D45_FI; break; case "DMD_BI": Row[_Month.ToString() + "/" + _Year.ToString()] = DMD_BI; break; case "D45_BI": Row[_Month.ToString() + "/" + _Year.ToString()] = D45_BI; break; case "DMD_FSBU": Row[_Month.ToString() + "/" + _Year.ToString()] = DMD_FSBU; break; case "D45_FSBU": Row[_Month.ToString() + "/" + _Year.ToString()] = D45_FSBU; break; default: break; } } Data_Import.Singleton().Save_DataTableToTXT2(ref SumPNC, "SumPNC"); }
public LoadPerson(ComboBox Person) { DataTable Access = new DataTable(); DataRow FoundAccess; Data_Import.Singleton().Load_TxtToDataTable2(ref Access, "Access"); FoundAccess = Access.Select(string.Format("Name LIKE '%{0}%'", Person.Text)).FirstOrDefault(); if (FoundAccess == null) { return; } ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminAccessFullName", true).First()).Text = FoundAccess["FullName"].ToString(); ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminAccess_Email", true).First()).Text = FoundAccess["Mail"].ToString(); if (FoundAccess["Role"].ToString() == "Employee") { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).SelectedIndex = 0; } else if (FoundAccess["Role"].ToString() == "EleMenager") { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).SelectedIndex = 1; } else if (FoundAccess["Role"].ToString() == "MechMenager") { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).SelectedIndex = 2; } else if (FoundAccess["Role"].ToString() == "NVRMenager") { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).SelectedIndex = 3; } else if (FoundAccess["Role"].ToString() == "PCMenager") { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).SelectedIndex = 4; } else if (FoundAccess["Role"].ToString() == "Admin") { ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Cb_AdminAccessMenager", true).First()).SelectedIndex = 5; } if (FoundAccess["Action"].ToString() == "Developer") { ((RadioButton)MainProgram.Self.TabControl.Controls.Find("radbut_AdminViwer", true).First()).Checked = false; ((RadioButton)MainProgram.Self.TabControl.Controls.Find("radbut_AdminDevelop", true).First()).Checked = true; } else { ((RadioButton)MainProgram.Self.TabControl.Controls.Find("radbut_AdminViwer", true).First()).Checked = true; ((RadioButton)MainProgram.Self.TabControl.Controls.Find("radbut_AdminDevelop", true).First()).Checked = false; } ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabAction", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_Action"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminElectronic", true).First()).Checked = Convert.ToBoolean(FoundAccess["ActionEle"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminMechanic", true).First()).Checked = Convert.ToBoolean(FoundAccess["ActionMech"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminNVR", true).First()).Checked = Convert.ToBoolean(FoundAccess["ActionNVR"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabSummary", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_Summary"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabStatistic", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_Statistic"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabPlatform", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_Platform"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabSTK", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_STK"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabQuantity", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_Quantity"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_AdminTabAdmin", true).First()).Checked = Convert.ToBoolean(FoundAccess["tab_Admin"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapEle", true).First()).Checked = Convert.ToBoolean(FoundAccess["EleApprove"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapMech", true).First()).Checked = Convert.ToBoolean(FoundAccess["MechApprove"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapNVR", true).First()).Checked = Convert.ToBoolean(FoundAccess["NVRApprove"].ToString()); ((CheckBox)MainProgram.Self.TabControl.Controls.Find("cb_Admin_RapPC", true).First()).Checked = Convert.ToBoolean(FoundAccess["PCApprove"].ToString()); }
/// <summary> /// Ładowanie Zrzutu z IDB do DataTable i zapis tej Tabeli do Bazy danych /// </summary> public IDBLoadDataBase() { _Import = Data_Import.Singleton(); LoadDataBase(); }
public void UpdateReporting(object state) { lock (this) { DataTable Frozen = new DataTable(); DataRow FrozenYear; decimal Year; bool CanBeApprove = false; Data_Import.Singleton().Load_TxtToDataTable2(ref Frozen, "Frozen"); Year = MainProgram.Self.sdOptions1.GetYear(); FrozenYear = Frozen.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).First(); //MessageBox.Show("zrobił"); foreach (DataColumn Column in Frozen.Columns) { if (Column.ColumnName != "Year" && Column.ColumnName != "EleApp" && Column.ColumnName != "MechApp" && Column.ColumnName != "NVRApp") { if (FrozenYear[Column].ToString() == "Open") { CanBeApprove = true; break; } } } if (CanBeApprove && Users.Singleton.ElectronicApprove && FrozenYear["EleApp"].ToString() != "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { true, "Electronic" }); } else { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { false, "Electronic" }); } if (CanBeApprove && Users.Singleton.MechanicApprove && FrozenYear["MechApp"].ToString() != "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { true, "Mechanic" }); } else { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { false, "Mechanic" }); } if (CanBeApprove && Users.Singleton.NVRApprove && FrozenYear["NVRApp"].ToString() != "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { true, "NVR" }); } else { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { false, "NVR" }); } if (CanBeApprove && Users.Singleton.PCApprove && FrozenYear["EleApp"].ToString() == "Approve" && FrozenYear["MechApp"].ToString() != "Approve" && FrozenYear["NVRApp"].ToString() != "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { true, "PC" }); } else { _sDReporting.Invoke(_sDReporting.myDeleate, new object[] { false, "PC" }); } if (Users.Singleton.PCApprove) { if (FrozenYear["EleApp"].ToString() == "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate2, new object[] { true, "Electronic" }); } else { if (Users.Singleton.Role != "Admin") { _sDReporting.Invoke(_sDReporting.myDeleate2, new object[] { false, "Electronic" }); } } if (FrozenYear["MechApp"].ToString() == "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate2, new object[] { true, "Mechanic" }); } else { if (Users.Singleton.Role != "Admin") { _sDReporting.Invoke(_sDReporting.myDeleate2, new object[] { false, "Mechanic" }); } } if (FrozenYear["MechApp"].ToString() == "Approve") { _sDReporting.Invoke(_sDReporting.myDeleate2, new object[] { true, "NVR" }); } else { if (Users.Singleton.Role != "Admin") { _sDReporting.Invoke(_sDReporting.myDeleate2, new object[] { false, "PC" }); } } } } }
public StatisticDMLoad() { _Import = Data_Import.Singleton(); LoadData_DM(); }
public StatisticQuantityMonthLoad() { _Import = Data_Import.Singleton(); LoadData_QuantityMonth(); }
private void TargetSave() { DataTable Targets = new DataTable(); DataRow TargetsRow; int Revision; Data_Import.Singleton().Load_TxtToDataTable2(ref Targets, "Kurs"); TargetsRow = Targets.Select(string.Format("Year LIKE '%{0}%'", _Year.ToString())).First(); if (TargetsRow != null) { string[] DM = (TargetsRow["DM"].ToString()).Split('/'); string[] PC = (TargetsRow["PC"].ToString()).Split('/'); string[] Ele = (TargetsRow["Ele"].ToString()).Split('/'); string[] Mech = (TargetsRow["Mech"].ToString()).Split('/'); string[] NVR = (TargetsRow["NVR"].ToString()).Split('/'); string DMSum = ""; string PCSum = ""; string EleSum = ""; string MechSum = ""; string NVRSum = ""; Revision = ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Comb_AdminTargetsRewizja", true).First()).SelectedIndex; DM[Revision] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsDM", true).First()).Text.Replace(" ", ""); PC[Revision] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsPercent", true).First()).Text.Replace(" ", ""); Ele[Revision] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsElePercent", true).First()).Text.Replace(" ", ""); Mech[Revision] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsMechPercent", true).First()).Text.Replace(" ", ""); NVR[Revision] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsNVRPercent", true).First()).Text.Replace(" ", ""); for (int counter = 0; counter <= 4; counter++) { DMSum = DMSum + DM[counter] + "/"; PCSum = PCSum + PC[counter] + "/"; EleSum = EleSum + Ele[counter] + "/"; MechSum = MechSum + Mech[counter] + "/"; NVRSum = NVRSum + NVR[counter] + "/"; } TargetsRow["DM"] = DMSum; TargetsRow["PC"] = PCSum; TargetsRow["Ele"] = EleSum; TargetsRow["Mech"] = MechSum; TargetsRow["NVR"] = NVRSum; } else { string Begining; string End; TargetsRow = Targets.NewRow(); TargetsRow["PC"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsPercent", true).First()).Text.Replace(" ", ""); TargetsRow["Ele"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsElePercent", true).First()).Text.Replace(" ", ""); TargetsRow["Mech"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsMechPercent", true).First()).Text.Replace(" ", ""); TargetsRow["NVR"] = ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsNVRPercent", true).First()).Text.Replace(" ", ""); Revision = ((ComboBox)MainProgram.Self.TabControl.Controls.Find("Comb_AdminTargetsRewizja", true).First()).SelectedIndex; switch (Revision) { case 0: Begining = ""; End = "/////"; break; case 1: Begining = "/"; End = "////"; break; case 2: Begining = "//"; End = "///"; break; case 3: Begining = "///"; End = "//"; break; case 4: Begining = "////"; End = "/"; break; default: Begining = ""; End = ""; break; } TargetsRow["DM"] = Begining + ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsDM", true).First()).Text.Replace(" ", "") + End; TargetsRow["PC"] = Begining + ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsPercent", true).First()).Text.Replace(" ", "") + End; TargetsRow["Ele"] = Begining + ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsElePercent", true).First()).Text.Replace(" ", "") + End; TargetsRow["Mech"] = Begining + ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsMechPercent", true).First()).Text.Replace(" ", "") + End; TargetsRow["NVR"] = Begining + ((TextBox)MainProgram.Self.TabControl.Controls.Find("Tb_AdminTargetsNVRPercent", true).First()).Text.Replace(" ", "") + End; Targets.Rows.Add(TargetsRow); } Data_Import.Singleton().Save_DataTableToTXT2(ref Targets, "Kurs"); }
public SentTo() { _Import = Data_Import.Singleton(); }
public SDReportingApproval(string Devision) { DataTable Frozen = new DataTable(); DataRow FrozenRow; decimal Year = MainProgram.Self.sdOptions1.GetYear(); string MailTo; string ToReject; Data_Import.Singleton().Load_TxtToDataTable2(ref Frozen, "Frozen"); FrozenRow = Frozen.Select(string.Format("Year LIKE '%{0}%'", Year.ToString())).First(); ToReject = WhatIsToApprove(FrozenRow); if (FrozenRow != null) { if (Devision == "Electronic Rejected") { FrozenRow["EleApp"] = "Close"; MailTo = new SentTo(true, false, false, false).SentToList(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().ReportRejected_Devision_Topic(), new MailInfo().ReportRejected_Devision_Body(ToReject)); } else if (Devision == "Mechanic Rejected") { FrozenRow["MechApp"] = "Close"; MailTo = new SentTo(false, true, false, false).SentToList(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().ReportRejected_Devision_Topic(), new MailInfo().ReportRejected_Devision_Body(ToReject)); } else if (Devision == "NVR Rejected") { FrozenRow["NVRApp"] = "Close"; MailTo = new SentTo(false, false, true, false).SentToList(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().ReportRejected_Devision_Topic(), new MailInfo().ReportRejected_Devision_Body(ToReject)); } else if (Devision == "Electronic Approve") { FrozenRow["EleApp"] = "Approve"; MailTo = new SentTo().SentToAdmin(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().RaportApprove_Devision_Topic("Electronic"), new MailInfo().RaportApprove_Devision_Body("Electronic", ToReject)); CheckIfAllDevisionApprove(FrozenRow, ToReject); } else if (Devision == "Mechanic Approve") { FrozenRow["MechApp"] = "Approve"; MailTo = new SentTo().SentToAdmin(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().RaportApprove_Devision_Topic("Mechanic"), new MailInfo().RaportApprove_Devision_Body("Mechanic", ToReject)); CheckIfAllDevisionApprove(FrozenRow, ToReject); } else if (Devision == "NVR Approve") { FrozenRow["NVRApp"] = "Approve"; MailTo = new SentTo().SentToAdmin(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().RaportApprove_Devision_Topic("NVR"), new MailInfo().RaportApprove_Devision_Body("NVR", ToReject)); CheckIfAllDevisionApprove(FrozenRow, ToReject); } else if (Devision == "Product Care Approve") { FrozenRow["EleApp"] = "Close"; FrozenRow["MechApp"] = "Close"; FrozenRow["NVRApp"] = "Close"; FrozenRow[ToReject] = "Approve"; MailTo = new SentTo(true, true, true, true).SentToList(); SentEmail.Instance.Sent_Email(MailTo, new MailInfo().RaportApprove_PC_Topic(ToReject), new MailInfo().RaportApprove_PC_Body(ToReject)); } } Data_Import.Singleton().Save_DataTableToTXT2(ref Frozen, "Frozen"); }