Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Form newItemForm = new NewItemForm(fullList);

            this.Hide();
            newItemForm.ShowDialog();
            this.Close();
        }
Ejemplo n.º 2
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (comboBox1.Text.Equals(""))
     {
         MessageBox.Show("Please choose a Material Type", "Yo", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
         return;
     }
     if (saveToFile())
     {
         Form resetPage = new NewItemForm(fullList);
         this.Hide();
         resetPage.ShowDialog();
         this.Close();
     }
 }
Ejemplo n.º 3
0
        public bool saveToFile()
        {
            string na = "N/A";
            string ip = "In Process";

            try
            {
                if (comboBox1.SelectedItem.ToString().Equals("Zircad"))
                {
                    newBatch.SizeShade      = comboBox2.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString();
                    newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.DimensionStatus = newBatch.DTStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = ip;
                    newBatch.DiscRingStatus = newBatch.HomogeneityStatus = newBatch.PowderStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Zirlux"))
                {
                    newBatch.SizeShade       = comboBox2.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString();
                    newBatch.DiscRingStatus  = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ShadeStatus = newBatch.ArchimedesStatus = ip;
                    newBatch.DimensionStatus = newBatch.PowderStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("ZenostarMO"))
                {
                    newBatch.SizeShade        = comboBox2.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString();
                    newBatch.StrengthStatus   = newBatch.PSHardnessStatus = newBatch.ShadeStatus = ip;
                    newBatch.ArchimedesStatus = newBatch.DiscRingStatus = newBatch.DimensionStatus = newBatch.PowderStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Powder"))
                {
                    newBatch.SizeShade      = textBox3.Text;
                    newBatch.PowderStatus   = ip;
                    newBatch.DiscRingStatus = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DimensionStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Emax Glassblock"))
                {
                    newBatch.SizeShade      = comboBox5.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString();
                    newBatch.XRFStatus      = ip;
                    newBatch.DiscRingStatus = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DimensionStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.PowderStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Emax Single"))
                {
                    newBatch.SizeShade = comboBox5.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString();
                    if (comboBox4.SelectedItem.ToString().Equals("Full"))
                    {
                        newBatch.StrengthStatus = newBatch.DTStatus = newBatch.MinoltaStatus = newBatch.XRDStatus = newBatch.StrengthStatus = newBatch.DimensionStatus = newBatch.HomogeneityStatus = ip;
                        newBatch.DiscRingStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.PowderStatus = newBatch.ShearStatus = newBatch.PackagingStatus = newBatch.XRFStatus = na;
                    }
                    else if (comboBox4.SelectedItem.ToString().Equals("Dynamic"))
                    {
                        newBatch.MinoltaStatus  = newBatch.XRDStatus = newBatch.StrengthStatus = newBatch.DimensionStatus = newBatch.HomogeneityStatus = ip;
                        newBatch.DiscRingStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DTStatus = newBatch.PowderStatus = newBatch.ShearStatus = newBatch.PackagingStatus = newBatch.XRFStatus = newBatch.StrengthStatus = na;
                    }
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Procad Single"))
                {
                    newBatch.SizeShade = comboBox5.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString();
                    if (comboBox4.SelectedItem.ToString().Equals("Full"))
                    {
                        newBatch.StrengthStatus = newBatch.DimensionStatus = newBatch.HomogeneityStatus = ip;
                        newBatch.DiscRingStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DTStatus = newBatch.PowderStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = newBatch.XRFStatus = na;
                    }
                    else if (comboBox4.SelectedItem.ToString().Equals("Dynamic"))
                    {
                        newBatch.DimensionStatus = newBatch.HomogeneityStatus = ip;
                        newBatch.DiscRingStatus  = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DTStatus = newBatch.PowderStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = newBatch.XRFStatus = na;
                    }
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Procad Multi"))
                {
                    newBatch.SizeShade      = comboBox5.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString();
                    newBatch.DTStatus       = newBatch.DimensionStatus = newBatch.HomogeneityStatus = ip;
                    newBatch.DiscRingStatus = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.PowderStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.ShearStatus = newBatch.PackagingStatus = newBatch.XRFStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Emax Mandrel") || comboBox1.SelectedItem.ToString().Equals("Empress Mandrel"))
                {
                    newBatch.SizeShade      = comboBox5.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString() + " " + comboBox2.SelectedItem.ToString();
                    newBatch.ShearStatus    = newBatch.PackagingStatus = ip;
                    newBatch.DiscRingStatus = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DimensionStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.PowderStatus = na;
                }
                else if (comboBox1.SelectedItem.ToString().Equals("Zircad Mandrel"))
                {
                    newBatch.SizeShade = comboBox2.SelectedItem.ToString() + " " + comboBox3.SelectedItem.ToString();
                    if (comboBox2.SelectedItem.ToString().Equals("B55") || comboBox2.SelectedItem.ToString().Equals("B65") || comboBox2.SelectedItem.ToString().Equals("B65L") || comboBox2.SelectedItem.ToString().Equals("B85"))
                    {
                        newBatch.PackagingStatus = ip;
                        newBatch.DiscRingStatus  = newBatch.ShearStatus = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DimensionStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.PowderStatus = na;
                    }
                    else
                    {
                        newBatch.ShearStatus    = newBatch.PackagingStatus = ip;
                        newBatch.DiscRingStatus = newBatch.StrengthStatus = newBatch.PSHardnessStatus = newBatch.ArchimedesStatus = newBatch.ShadeStatus = newBatch.DimensionStatus = newBatch.DTStatus = newBatch.HomogeneityStatus = newBatch.XRFStatus = newBatch.XRDStatus = newBatch.MinoltaStatus = newBatch.PowderStatus = na;
                    }
                }

                newBatch.FinalApprovalStatus = ip;
                newBatch.ReceivedDate        = DateTime.Now.ToString();
                newBatch.TargetEndDate       = dateTimePicker1.Value.ToShortDateString();
                newBatch.Material            = comboBox1.SelectedItem.ToString();
                newBatch.BatchNum            = textBox1.Text;
                newBatch.Quantity            = textBox2.Text;
            }
            catch
            {
                MessageBox.Show("Please enter all data", "Watch out", MessageBoxButtons.OK);
                Form resetPage = new NewItemForm(fullList);
                this.Hide();
                resetPage.ShowDialog();
                this.Close();
            }



            fullList.Add(newBatch);
            var csv = new StringBuilder();

            csv.AppendLine("Material,Batch #,Received Date,Target End Date,Strength Status,Strength Date,PS/Hardness Status,PS/Hardness Date,Dimension Status,Dimension Date,DT Status,DT Date,Archimedes Status,Archimedes Date,Shade Status,Shade Date,Homogeneity Status,Homogeneity Date,XRF Status,XRF Date,XRD Status,XRD Date,Minolta Status,Minolta Date,Shear Status ,Shear Date,Packaging Status,Packaging Date,Final Approval Status,Final Approval Date,Lead Time ,Comments,Quantity,SizeShade,Powder Status,Powder Date,Disc w/Ring Status,Disc w/Ring Date,Ignore");
            for (int i = 0; i < fullList.Count; i++)
            {
                var newLine = String.Format("{0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16},{17},{18},{19},{20},{21},{22},{23},{24},{25},{26},{27},{28},{29},{30},{31},{32},{33},{34},{35},{36},{37},0", fullList[i].Material, fullList[i].BatchNum, fullList[i].ReceivedDate, fullList[i].TargetEndDate, fullList[i].StrengthStatus, fullList[i].StrengthDate, fullList[i].PSHardnessStatus, fullList[i].PSHardnessDate, fullList[i].DimensionStatus, fullList[i].DimensionDate, fullList[i].DTStatus, fullList[i].DTDate, fullList[i].ArchimedesStatus, fullList[i].ArchimedesDate, fullList[i].ShadeStatus, fullList[i].ShadeDate, fullList[i].HomogeneityStatus, fullList[i].HomogeneityDate, fullList[i].XRFStatus, fullList[i].XRFDate, fullList[i].XRDStatus, fullList[i].XRDDate, fullList[i].MinoltaStatus, fullList[i].MinoltaDate, fullList[i].ShearStatus, fullList[i].ShearDate, fullList[i].PackagingStatus, fullList[i].PackagingDate, fullList[i].FinalApprovalStatus, fullList[i].FinalApprovalDate, fullList[i].LeadTime, fullList[i].Comments, fullList[i].Quantity, fullList[i].SizeShade, fullList[i].PowderStatus, fullList[i].PowderDate, fullList[i].DiscRingStatus, fullList[i].DiscRingDate, "0");
                csv.AppendLine(newLine);
            }

            DialogResult result = DialogResult.Retry;

            while (result == DialogResult.Retry)
            {
                try
                {
                    File.WriteAllText("G:\\QC\\QC Milling Ceramics\\QC Open Orders.csv", csv.ToString());
                    return(true);
                }
                catch
                {
                    result = MessageBox.Show("G:\\QC\\QC Milling Ceramics\\QC Open Orders_temp.csv\nFile in Use\nClose File & Retry", "Yo", MessageBoxButtons.RetryCancel, MessageBoxIcon.Exclamation);
                    if (result == DialogResult.Cancel)
                    {
                        fullList.Remove(fullList.Last());
                        return(false);
                    }
                }
            }
            return(true);
        }