Пример #1
0
        static void Main(string[] args)
        {
            batch Cookiebatch = new batch();

            Cookiebatch.createcookies(true, true, "round", "oatmeal");
            Cookiebatch.createcookies(true, true, "round", "sugar");
            Cookiebatch.createcookies(true, true, "round", "gingerbread");
            Cookiebatch.createcookies(true, true, "round", "chocolate chip");
            Cookiebatch.createcookies(true, false, "round", "oatmeal");
            Cookiebatch.createcookies(true, false, "round", "sugar");
            Cookiebatch.createcookies(false, true, "round", "gingerbread");
            Cookiebatch.createcookies(true, true, "round", "chocolatechip");
            Cookiebatch.createcookies(true, true, "oval", "oatmeal");
            Cookiebatch.createcookies(false, true, "round", "oatmeal");
            Cookiebatch.createcookies(true, true, "round", "gingerbread");
            Cookiebatch.createcookies(false, false, "round", "oatmeal");

            int cookies;

            for (cookies = 1; cookies <= Cookiebatch.cookiebatch.Count; cookies++)

            {
                Console.WriteLine(Cookiebatch.cookiebatch[cookies - 1].type);

                Console.WriteLine(Cookiebatch.cookiebatch[cookies - 1].shape);

                Console.WriteLine(Cookiebatch.cookiebatch[cookies - 1].hasFilling);

                Console.WriteLine(Cookiebatch.cookiebatch[cookies - 1].hasIcing);
            }

            Console.ReadKey();
        }
        public ActionResult DeleteConfirmed(int id)
        {
            batch batch = db.batches.Find(id);

            db.batches.Remove(batch);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,batch1,year")] batch batch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(batch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(batch));
 }
Пример #4
0
        private static void GetBatch(ref List <batch> batches, Int32 lineNum, XElement deliveryLineElement, Decimal quantity, Int32 itemId)
        {
            String batchNumber        = String.Empty;
            String heatNumber         = String.Empty;
            String certificateIndexNr = String.Empty;

            var batchNumberElement = deliveryLineElement.Elements("E1EDL43").Where(c => c.Element("QUALF").Value.Equals("X")).FirstOrDefault();

            if (batchNumberElement != null)
            {
                batchNumber = batchNumberElement.Element("BELNR").Value;
            }

            if (!String.IsNullOrEmpty(batchNumber))
            {
                var heatNumberElement = deliveryLineElement.Elements("E1EDL43").Where(c => c.Element("QUALF").Value.Equals("Y")).FirstOrDefault();
                if (heatNumberElement != null)
                {
                    var heatNumberElement2 = heatNumberElement.Element("BELNR");
                    if (heatNumberElement2 != null)
                    {
                        heatNumber = heatNumberElement2.Value;
                    }
                }

                var certificateIndexElement = deliveryLineElement.Elements("E1EDL43").Where(c => c.Element("QUALF").Value.Equals("Z")).FirstOrDefault();
                if (certificateIndexElement != null)
                {
                    var certificateIndexElement2 = certificateIndexElement.Element("BELNR");
                    if (certificateIndexElement2 != null)
                    {
                        certificateIndexNr = certificateIndexElement2.Value;
                    }
                }

                String certificateDocID = String.Empty;
                if (deliveryLineElement.Element("MFRPN") != null)
                {
                    certificateDocID = deliveryLineElement.Element("MFRPN").Value;
                }

                batch batch = new batch();
                batch.itemId                 = itemId;
                batch.batchNumber            = batchNumber;
                batch.heatNumber             = heatNumber;
                batch.ixosArchiveId          = certificateDocID;
                batch.certificateIndexNumber = certificateIndexNr;

                batch.batchDocuments.Add(new batchDocument()
                {
                    baseLineNum = lineNum, quantity = quantity
                });
                batches.Add(batch);
            }
        }
Пример #5
0
 public void update(batch c)
 {
     try
     {
         d.update(c);
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
Пример #6
0
 public void delete(batch c)
 {
     try
     {
         d.delete(c);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Пример #7
0
 public void insert(batch c)
 {
     try
     {
         d.insert(c);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
        public ActionResult Create([Bind(Include = "Id,batch1,year")] batch batch)
        {
            if (ModelState.IsValid)
            {
                db.batches.Add(batch);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(batch));
        }
Пример #9
0
 public void search(batch c)
 {
     try
     {
         d.search(c);
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
Пример #10
0
 public ActionResult Edit([Bind(Include = "id,batch1,year")] batch batch)
 {
     if (ModelState.IsValid)
     {
         db.Entry(batch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id = new SelectList(db.batches, "id", "batch1", batch.id);
     ViewBag.id = new SelectList(db.batches, "id", "batch1", batch.id);
     return(View(batch));
 }
Пример #11
0
        public ActionResult Create([Bind(Include = "id,batch1,year")] batch batch)
        {
            if (ModelState.IsValid)
            {
                db.batches.Add(batch);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            ViewBag.id = new SelectList(db.batches, "id", "batch1", batch.id);
            ViewBag.id = new SelectList(db.batches, "id", "batch1", batch.id);
            return(View(batch));
        }
Пример #12
0
 public ActionResult Edit(batch batch)
 {
     if (!isUniqueBatchName(batch.name))
     {
         ModelState.AddModelError(String.Empty, "Batch already exists");
     }
     if (ModelState.IsValid)
     {
         db.Entry(batch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(batch));
 }
        // GET: /batch/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            batch batch = db.batches.Find(id);

            if (batch == null)
            {
                return(HttpNotFound());
            }
            return(View(batch));
        }
Пример #14
0
 public ActionResult Create(batch batch)
 {
     if (!isUniqueBatchName(batch.name))
     {
         ModelState.AddModelError(String.Empty, "Batch already exists");
     }
     if (ModelState.IsValid)
     {
         db.batches.Add(batch);
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(batch));
 }
Пример #15
0
        // GET: Batches/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            batch batch = db.batches.Find(id);

            if (batch == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id = new SelectList(db.batches, "id", "batch1", batch.id);
            ViewBag.id = new SelectList(db.batches, "id", "batch1", batch.id);
            return(View(batch));
        }
Пример #16
0
        public ActionResult AddBatch(batch model)
        {
            if (ModelState.IsValid)
            {
                CMSEntities db = new CMSEntities();

                db.batches.Add(model);
                db.SaveChanges();

                return(JavaScript("New Batch Added Successfully!"));
            }
            else
            {
                return(View(model));
            }
        }
Пример #17
0
        public ActionResult New(TablaViewModel model)
        {
            WebService1SoapClient client = new WebService1SoapClient();


            var batch = new batch();

            batch.ID_Movie          = model.ID_Movie;
            batch.Description_Movie = model.Description_Movie;
            batch.Duration          = model.Duration;
            batch.State             = model.State;

            client.AddMovie(model.ID_Movie, model.Description_Movie, model.Duration, model.State);


            return(Redirect("~/Movie/"));
        }
Пример #18
0
        public static void batchReader(string csvFilePath, List <batch> inputbatch)
        {
            string       line;
            StreamReader fs = new StreamReader(csvFilePath);

            fs.ReadLine();
            while ((line = fs.ReadLine()) != null)
            {
                string[] s     = line.Split(new char[] { ';' });
                batch    sline = new batch();
                sline.Item_ID     = s[0];
                sline.Length_Item = s[1];
                sline.Width_Item  = s[2];
                sline.Stack       = s[3];
                sline.Sequence    = s[4];
                inputbatch.Add(sline);
            }
        }
Пример #19
0
 public void delete(batch Batch)
 {
     try
     {
         fill_dataset();
         foreach (DataRow dr in data.Tables[0].Rows)
         {
             if (Convert.ToInt16(dr["Address_ID"]) == Batch.Address_ID)
             {
                 dr.Delete();
             }
         }
     }
     catch (Exception e)
     {
         throw e;
     }
     update();
 }
Пример #20
0
        public void insert(batch Batch)
        {
            try
            {
                fill_dataset();
                dr = data.Tables[0].NewRow();
                dr["First_name"] = Batch.First_name;
                dr["Last_name"]  = Batch.Last_name;
                dr["Email"]      = Batch.Email;
                dr["Phone"]      = Batch.Phone;

                data.Tables[0].Rows.Add(dr);
                update();
            }
            catch (Exception e)
            {
                throw (e);
            }
        }
Пример #21
0
 public void update(batch course)
 {
     try
     {
         fill_dataset();
         foreach (DataRow dr in data.Tables[0].Rows)
         {
             if (Convert.ToInt16(dr["Address_ID"]) == course.Address_ID)
             {
                 dr["First_name"] = course.First_name;
                 dr["Last_name"]  = course.Last_name;
             }
         }
         update();
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
Пример #22
0
 public void search(batch course)
 {
     fill_dataset();
     try
     {
         foreach (DataRow dr in data.Tables[0].Rows)
         {
             if (Convert.ToInt16(dr["Address_ID"]) == course.Address_ID)
             {
                 course.First_name = Convert.ToString(dr["course_name"]);
                 course.Last_name  = Convert.ToString(dr["Last_name"]);
                 course.Email      = Convert.ToString(dr["Email"]);
             }
         }
         update();
     }
     catch (Exception e)
     {
         throw (e);
     }
 }
Пример #23
0
        private static Boolean ProcessBatches(delivery deliveryDocument, List <batch> batches)
        {
            DALPortalDataContext dc = new DALPortalDataContext();
            Boolean returnValue     = true;

            // Remove all batches attached to this document
            BatchClass.RemoveBatchesDocument(deliveryDocument.docId, deliveryDocument.docType, dc);

            foreach (batch batchLine in batches)
            {
                try
                {
                    batch batch = BatchClass.GetBatch(batchLine.batchNumber, batchLine.heatNumber, batchLine.itemId, deliveryDocument.companyCode, dc);

                    Boolean newBatch = false;
                    if (batch == null)
                    {
                        batch    = new batch();
                        newBatch = true;
                    }

                    if (newBatch)
                    {
                        batch.batchNumber = batchLine.batchNumber;
                        batch.companyCode = deliveryDocument.companyCode;
                    }

                    batch.itemId = batchLine.itemId;
                    batch.certificateIndexNumber = batchLine.certificateIndexNumber;
                    batch.heatNumber             = batchLine.heatNumber;
                    batch.ixosArchiveId          = batchLine.ixosArchiveId;

                    if (newBatch)
                    {
                        // Check if certificate is already on the server
                        String fileName = "CERT_" + batchLine.ixosArchiveId + ".pdf";
                        String filePath = Path.Combine(Parameters_DataProcessor.CompanyFilesRoot, "Certificates", fileName);
                        String dbPath   = Path.Combine(@"~\Files\Certificates", fileName);

                        if (File.Exists(filePath))
                        {
                            batch.certificateLink = dbPath;
                        }
                    }

                    foreach (batchDocument batchDocLine in batchLine.batchDocuments)
                    {
                        // Check if Batch relates to document
                        batchDocument batchDoc    = batch.batchDocuments.Where(c => c.baseDocId.Equals(deliveryDocument.docId) && c.baseLineNum.Equals(batchDocLine.baseLineNum) && c.baseDocType.Equals("DL")).FirstOrDefault();
                        Boolean       newBatchDoc = false;
                        if (batchDoc == null)
                        {
                            newBatchDoc          = true;
                            batchDoc             = new batchDocument();
                            batchDoc.baseDocId   = deliveryDocument.docId;
                            batchDoc.baseLineNum = batchDocLine.baseLineNum;
                            batchDoc.baseDocType = "DL";
                        }

                        batchDoc.quantity = batchDocLine.quantity;

                        if (newBatchDoc)
                        {
                            batch.batchDocuments.Add(batchDoc);
                        }
                    }

                    if (newBatch)
                    {
                        dc.batches.InsertOnSubmit(batch);
                    }

                    dc.SubmitChanges();
                }
                catch (Exception ex)
                {
                    Trace.WriteLine(String.Format("Error Processing Batches for Delivery {0} for company {1}. Error: {2}", deliveryDocument.documentNumber, deliveryDocument.companyCode, ex.Message), "ProcessBatches");
                    returnValue = false;
                }
            }

            return(returnValue);
        }
Пример #24
0
        public LinkedList <return19> setStuBatch()
        {
            LinkedList <return19> result      = new LinkedList <return19>();
            CommonClass           commonClass = new CommonClass();

            commonClass.open();
            String date = DateTime.Now.ToShortDateString();
            //       date="2020-09-20";          //交代码要去掉这一行
            MySqlCommand cmd = new MySqlCommand("select  student_ID,student_name,date " +
                                                "from clockin_record natural join student " +
                                                "where date='" + date + "' and (current_province,current_city) in " +
                                                "(select province,city from pandemic_situation where date='" +
                                                date + "' and risk_level = 0)", commonClass.returnConn());
            MySqlDataReader dataReader = cmd.ExecuteReader();


            while (dataReader.Read())
            {
                return19 temp = new return19();
                temp.student_ID   = dataReader.GetString("student_ID");
                temp.student_name = dataReader.GetString("student_name");
                result.AddLast(temp);
            }
            commonClass.close();


            LinkedListNode <return19> po = result.First;

            while (po != result.Last)
            {
                commonClass.open();
                MySqlCommand    tempcmd19  = new MySqlCommand("select student_ID from back_info where student_ID='" + po.Value.student_ID + "'", commonClass.returnConn());
                MySqlDataReader tempread19 = tempcmd19.ExecuteReader();
                if (tempread19.Read())
                {
                    LinkedListNode <return19> pre = po;
                    po = po.Next;
                    result.Remove(pre);
                }
                else
                {
                    po = po.Next;
                }
                commonClass.close();
            }

            if (po == null)
            {
                ;
            }
            else
            {
                commonClass.open();
                MySqlCommand    tempcmd  = new MySqlCommand("select student_ID from back_info where student_ID='" + po.Value.student_ID + "'", commonClass.returnConn());
                MySqlDataReader tempread = tempcmd.ExecuteReader();
                if (tempread.Read())
                {
                    result.Remove(po);
                }
                commonClass.close();
            }



            commonClass.open();
            //得到返校批次信息;
            MySqlCommand       getbatch     = new MySqlCommand("select * from batch", commonClass.returnConn());
            MySqlDataReader    getbatchread = getbatch.ExecuteReader();
            LinkedList <batch> batches      = new LinkedList <batch>();

            while (getbatchread.Read())
            {
                batch temp = new batch();
                temp.batch_num = getbatchread.GetString("batch_num");
                temp.date      = getbatchread.GetString("date");
                batches.AddLast(temp);
            }
            commonClass.close();

            LinkedListNode <batch> point = batches.First;


            foreach (var item in result)
            {
                string batch_num = point.Value.batch_num;
                item.batch_num = batch_num;
                item.date      = Convert.ToDateTime(point.Value.date);
                point          = point.Next;
            }

            //插入到batch_info

            foreach (var item in result)
            {
                commonClass.open();
                MySqlCommand insert = new MySqlCommand("insert into back_info values('" + item.student_ID + "','" + item.date + "','null','null'," + item.batch_num + ", '2020-9');", commonClass.returnConn());
                insert.ExecuteNonQuery();
                commonClass.close();
            }



            return(result);
        }
Пример #25
0
        public ViewResult Details(int id)
        {
            batch batch = db.batches.Find(id);

            return(View(batch));
        }
Пример #26
0
        public ActionResult Edit(int id)
        {
            batch batch = db.batches.Find(id);

            return(View(batch));
        }
Пример #27
0
 var(batch, i) = b;
Пример #28
0
        public ActionResult AddBatch()
        {
            batch model = new batch();

            return(View(model));
        }
Пример #29
0
 public void add(batch entity)
 {
     btc.Insert(entity.Batch);
 }
        /// <summary>
        /// Loops over all the files we downloaded from the SFTP. Goes through the data line by line.
        /// Looks for a line beginning with "8" as that signifies a valid file structure
        /// </summary>
        private static void processFiles()
        {
            appendToBody(String.Format("Wells Fargo files to be processed: {0}", sftpFilesToProcess.Count()));
            //int count = 0;
            //Loop over each file.  We need to determine if it is a morning file and in the correct format
            foreach (var file in sftpFilesToProcess)
            {
                //create a new payment record list for each file ...
                batches = new List<batch>();
                bool validFile = false;
                bool multiCheck = false;
                try
                {
                    using (StreamReader sr = new StreamReader(file))
                    {
                        //appendToBody(String.Format("Parsing file {0}", file.Name));
                        string line = "";
                        string recordType = "";
                        currentPaymentRecord = null;
                        currentBatch = new batch();
                        currentInvoice = null;
                        invoiceValue = 0;
                        while ((line = sr.ReadLine()) != null && line.Length > 15)
                        {
                            line = line.Replace(" ", "");
                            recordType = line.Substring(0, 2);
                            Console.WriteLine(line);
                            switch (recordType)
                            {

                                    //File contains 1 FH
                                case "FH":
                                    //This is a header line.  We can pull the 10 digits and the date from this line...
                                    parseHeader(line);
                                    break;

                                    //File can contain multiple BH
                                case "BH":

                                    //create a new Batch
                                    currentBatch = new batch();

                                    break;

                                    //Each BH can contain multiple PR
                                case "PR":
                                    //In order for the file to be valid we have to have at least 1 payment record...
                                    validFile = true;
                                    currentBatch.numChecks++;

                                    //If there is no open paymentRecord. Create a new one
                                    if (!multiCheck){
                                        currentPaymentRecord = new paymentRecord();
                                        currentBatch.paymentRecords.Add(currentPaymentRecord);
                                    }
                                    //Every PR wil create a new "check".
                                    currentCheck = new check();
                                    currentCheck.checkAmount = parsePR(line);
                                    currentBatch.checkTotal += currentCheck.checkAmount;
                                    currentPaymentRecord.checks.Add(currentCheck);
                                    currentPaymentRecord.total += currentCheck.checkAmount;
                                    break;

                                    //Each PR will contain a SP
                                case "SP":
                                    //Need to parse the SP and see if the flag is set for additional checks
                                    multiCheck = parseSP(line);
                                    break;
                                    //Each PR can contain multiple IV
                                case "IV":
                                    currentBatch.numInvoices++;
                                    currentInvoice = new invoice();
                                    invoiceValue = parseIV(line);
                                    currentPaymentRecord.invoices.Add(currentInvoice);
                                    break;
                                case "SI":
                                    //Supplemental Invoice
                                    //Parse the line and determine what type of data it is...
                                    if (currentInvoice != null)
                                    {
                                        currentInvoice.invoiceDate = parseSI(line);
                                    }
                                    else {
                                        Console.WriteLine("Current invoice is null while reading in an SI...Should Never happen!!!! problem!");
                                        Console.ReadKey();
                                    }
                                    //push into the invoice
                                    break;
                                case "BT":
                                    //Trailer Record
                                    batches.Add(currentBatch);
                                    break;
                                default:
                                    //Do nothing
                                    //Console.WriteLine("unrecognized line header: {0}", line);
                                    break;
                            }
                        }
                        //close the file
                        sr.Close();
                    }
                    if (validFile)
                    {
                        string fileName = createOutputFile(file);
                        attachments.Add(new FileInfo(fileName));
                        appendToBody("");
                        //upload file ...
                        //ftpUploadFile(fileName, fileName);
                    }
                }
                catch (Exception e) {
                    Console.WriteLine("Exception processing file...{0}", e);
                    appendToBody(String.Format("Error while processing {0}", file));
                }
            }
            //appendToBody(String.Format("Processed {0} valid files", count));
        }