예제 #1
0
        private void butDel_Click(object sender, EventArgs e)
        {
            Clamp clamp = new Clamp()
            {
                Serialnum = tbSerial.Text
            };
            DialogResult dialogResult = MessageBox.Show("Are you sure you want to delete?", "Delete last added", MessageBoxButtons.YesNo);

            if (dialogResult == DialogResult.Yes)
            {
                bool result = ClampOperations.DeleteClamp(clamp);

                if (result)
                {
                    MessageBox.Show("Success");
                }
                else
                {
                    MessageBox.Show("Could not delete clamp");
                }
            }
            else if (dialogResult == DialogResult.No)
            {
                return;
            }
        }
예제 #2
0
        private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            try
            {
                if (!errorClamp.Clamptype.Contains("PC"))
                {
                    if (!Directory.Exists(save + @"\Final Control"))
                    {
                        Directory.CreateDirectory(save + @"\Final Control");
                    }
                    string dest     = save + @"\Final Control";
                    string destfile = "FC " + DateTime.Now.ToString("dd-MM-yyyy") + " " + textBox3.Text + " " + textBox4.Text + ".xlsx";

                    File.Copy(Path.Combine(direktorijum, "final control.xlsx"), Path.Combine(dest, destfile), true);

                    string editfile = dest + "\\" + destfile;

                    resultDB = ClampOperations.InsertClamp(errorClamp);
                    //ExcellClass.crateFinalControl(@"C:\Users\AleksandraTos\Documents\Visual Studio 2008\Projects\Control Generator\bin\Debug\final control.xlsx", @"Desktop\final control.xlsx", errorClamp);
                    resultEX = ExcellClass.crateFinalControl(editfile, errorClamp);
                }
                else
                {
                    if (!Directory.Exists(save + @"\Final Control"))
                    {
                        Directory.CreateDirectory(save + @"\Final Control");
                    }
                    string dest     = save + @"\Final Control";
                    string destfile = "FC " + DateTime.Now.ToString("dd-MM-yyyy") + " " + textBox3.Text + " " + textBox4.Text + ".xlsx";

                    File.Copy(Path.Combine(direktorijum, "final control PC.xlsx"), Path.Combine(dest, destfile), true);

                    string editfile = dest + "\\" + destfile;

                    resultDB = ClampOperations.InsertClamp(errorClamp);
                    //ExcellClass.crateFinalControl(@"C:\Users\AleksandraTos\Documents\Visual Studio 2008\Projects\Control Generator\bin\Debug\final control.xlsx", @"Desktop\final control.xlsx", errorClamp);
                    resultEX = ExcellClass.crateFinalControl(editfile, errorClamp);
                }
            }
            catch (Exception ex)
            {
                string newfolder = direktorijum + "\\Logs";
                if (!Directory.Exists(newfolder))
                {
                    Directory.CreateDirectory(newfolder);
                }
                newfolder += "\\log1" + DateTime.Now.ToString("dd_MM_yyyy hh_mm_ss") + ".txt";
                StreamWriter sw = new StreamWriter(newfolder);
                sw.Write(ex.ToString());
                sw.Close();
            }
        }
예제 #3
0
        private void BasicForm_Load(object sender, EventArgs e)
        {
            if (HiddenButtons)
            {
                butAdvanced.Hide();
                butDel.Dock = DockStyle.Top;
            }
            clamp         = ClampOperations.ReturnClamp();
            tbSerial.Text = clamp.Serialnum;
            tbRado.Text   = clamp.Rado;
            tbRN.Text     = clamp.Rn;

            textBox3.Text = clamp.Serialnum;
            textBox4.Text = clamp.Rado;

            NewForm(ff);
        }
예제 #4
0
        private void butSerialUpdate_Click(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(textBox6.Text) && !String.IsNullOrEmpty(textBox7.Text))
            {
                status.Text      = "Please wait...";
                status.ForeColor = Color.Red;
                status.Visible   = true;

                Clamp clamp = new Clamp()
                {
                    Rado      = textBox7.Text,
                    Serialnum = textBox6.Text
                };
                bool result = ClampOperations.UpdateClampBarcode(clamp);

                if (result)
                {
                    MessageBox.Show("Success");
                    textBox6.Clear();
                    textBox7.Clear();

                    status.ForeColor = Color.Green;
                    status.Text      = "Done";
                }
                else
                {
                    MessageBox.Show("Could not update your barcode");

                    status.ForeColor = Color.Red;
                    status.Text      = "Error";
                }
            }
            else
            {
                MessageBox.Show("Please fill in all data");
            }
        }
예제 #5
0
        private void BgWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            List <Clamp> counter = new List <Clamp>();

            if (buttonpressedPL && !buttonpressedFCR)
            {
                counter = ClampOperations.ReturnClampPackingList(textBox3.Text, textBox4.Text);
                if (counter.Count > 0)
                {
                    if (!Directory.Exists(save + @"\Packing List"))
                    {
                        Directory.CreateDirectory(save + @"\Packing List");
                    }
                    string dest     = save + @"\Packing List";
                    string destfile = "PL " + DateTime.Now.ToString("dd-MM-yyyy -- HH-mm-ss") + ".xlsx";

                    File.Copy(Path.Combine(direktorijum, "packing list.xlsx"), Path.Combine(dest, destfile), true);

                    string editfile = dest + "\\" + destfile;

                    resultPL = ExcellClass.createPackingList(editfile, counter, paramPL, ClampOperations.ReturnClampRN(textBox3.Text, textBox4.Text));

                    buttonpressedPL = false;

                    Process process = new Process();
                    process = Process.Start(editfile);
                }
                else
                {
                    resultPL = false;
                }
            }
            if (buttonpressedFCR && !buttonpressedPL)
            {
                counter = ClampOperations.ReturnClampFCR(textBox1.Text, textBox2.Text);
                if (counter.Count > 0)
                {
                    if (!Directory.Exists(save + @"\Final Control Report"))
                    {
                        Directory.CreateDirectory(save + @"\Final Control Report");
                    }
                    string dest     = save + @"\Final Control Report";
                    string destfile = "FCR " + DateTime.Now.ToString("dd-MM-yyyy -- HH-mm-ss") + ".xlsx";

                    File.Copy(Path.Combine(direktorijum, "final control report.xlsx"), Path.Combine(dest, destfile), true);

                    string editfile = dest + "\\" + destfile;

                    resultFCR = ExcellClass.createFinalControlReport(editfile, counter, dateTimePicker1.Value.ToString("dd-MM-yyyy"), ClampOperations.ReturnClampRN(textBox1.Text, textBox2.Text));

                    buttonpressedFCR = false;

                    Process process = new Process();
                    process = Process.Start(editfile);
                }
                else
                {
                    resultFCR = false;
                }
            }
        }