예제 #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            numInList = listBox1.SelectedIndex;
            if (numInList == -1)
            {
                MessageBox.Show("No Batch Selected", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }
            Form modifyPage = new ModifyItemForm(fullList, numInList);

            this.Hide();
            modifyPage.ShowDialog();
            this.Close();
        }
예제 #2
0
        private bool saveToFile()
        {
            try
            {
                DateTime dtEnd   = Convert.ToDateTime(fullList[numIndex].ReceivedDate);
                DateTime dtBegin = Convert.ToDateTime(fullList[numIndex].FinalApprovalDate);
                fullList[numIndex].LeadTime = dtBegin.Subtract(dtEnd).TotalDays.ToString();
            }
            catch { }
            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)
                    {
                        Form reset = new ModifyItemForm(fullList, numIndex);
                        this.Hide();
                        reset.ShowDialog();
                        return(false);
                    }
                }
            }
            return(true);
        }