コード例 #1
0
 private void t1_Elapsed(object source, ElapsedEventArgs e)
 {
     try
     {
         RunGetXMLFiles();
     }
     catch (Exception ex)
     {
         Default.html += DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "[Getting]" + ex.Message + "<br />";
         Jinsdb.AddLog(ex.Message);
     }
 }
コード例 #2
0
 void t4_Elapsed(object sender, ElapsedEventArgs e)
 {
     try
     {
         RunConvertXMLFiles();
     }
     catch (Exception ex)
     {
         Default.html += DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "[Convert]" + ex.Message + "<br />";
         Jinsdb.AddLog(ex.Message);
     }
 }
コード例 #3
0
 void t3_Elapsed(object sender, ElapsedEventArgs e)
 {
     try
     {
         RunGetShippingXMLFiles();
         RunUploadShippingXMLFiles();
     }
     catch (Exception ex)
     {
         Default.html += DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToLongTimeString() + "[Shipping]" + ex.Message + "<br />";
         Jinsdb.AddLog(ex.Message);
     }
 }
コード例 #4
0
ファイル: Jinsxml.cs プロジェクト: peter-ay/jinsftpweb
        public static OrdMain ConvertXMLtoOrdModel(string xmlPath)
        {
            OrdMain model = new OrdMain();
            var     file  = xmlPath.Substring(xmlPath.LastIndexOf("\\") + 1);

            model.OrdID = file.Substring(0, file.LastIndexOf("."));
            model.ID    = "";
            try
            {
                using (XmlReader _XReader = XmlReader.Create(xmlPath))
                {
                    XElement _XElement = XElement.Load(_XReader);
                    model.OrdHdID  = _XElement.Element("purchase_order_header_id").Value;
                    model.OrdType  = _XElement.Element("po_type_id").Value;
                    model.Address1 = _XElement.Element("address").Value;
                    model.Postal   = _XElement.Element("postal").Value;
                    model.Tel      = _XElement.Element("telephone").Value;
                    model.Memo     = _XElement.Element("memorandum").Value;
                    var t = _XElement.Element("created").Value;
                    try { model.Created = Convert.ToDateTime(t); }
                    catch { model.Created = DateTime.Now; }
                    model.SalesOfficeCode = _XElement.Element("salesOfficeCode").Value;
                    model.SalesOfficeName = _XElement.Element("salesOfficeName").Value;
                    try { model.Procurement_Type = _XElement.Element("procurement_type").Value; }
                    catch { model.Procurement_Type = ""; }
                    //
                    switch (model.OrdType)
                    {
                    case "rx":
                        model.SubRX = new OrdRX();
                        var modelrx = model.SubRX;
                        var _detail = _XElement.Elements("detail").FirstOrDefault();
                        //
                        modelrx.SpecialRight1 = _detail.Element("specialright1").Value;
                        modelrx.SpecialRight2 = _detail.Element("specialright2").Value;
                        modelrx.SpecialRight3 = _detail.Element("specialright3").Value;
                        modelrx.SpecialRight4 = _detail.Element("specialright4").Value;
                        modelrx.SpecialLeft1  = _detail.Element("specialleft1").Value;
                        modelrx.SpecialLeft2  = _detail.Element("specialleft2").Value;
                        modelrx.SpecialLeft3  = _detail.Element("specialleft3").Value;
                        modelrx.SpecialLeft4  = _detail.Element("specialleft4").Value;
                        //
                        modelrx.Lens_Type = _detail.Element("lens_type").Value;
                        modelrx.Tint_Type = _detail.Element("tint_type").Value;
                        modelrx.Tint      = _detail.Element("tint").Value;
                        modelrx.Polarized = _detail.Element("polarized").Value;
                        modelrx.Mirrored  = _detail.Element("mirrored").Value;
                        //
                        modelrx.Oculus_Dexter_Sphere     = _detail.Element("oculus_dexter_sphere").Value.GetDecimalStr();
                        modelrx.Oculus_Sinister_Sphere   = _detail.Element("oculus_sinister_sphere").Value.GetDecimalStr();
                        modelrx.Oculus_Dexter_Cylinder   = _detail.Element("oculus_dexter_cylinder").Value.GetDecimalStr();
                        modelrx.Oculus_Sinister_Cylinder = _detail.Element("oculus_sinister_cylinder").Value.GetDecimalStr();
                        modelrx.Oculus_Dexter_Axis       = _detail.Element("oculus_dexter_axis").Value.GetDecimalStr();
                        modelrx.Oculus_Sinister_Axis     = _detail.Element("oculus_sinister_axis").Value.GetDecimalStr();
                        modelrx.Oculus_Dexter_Add        = _detail.Element("oculus_dexter_add").Value.GetDecimalStr();
                        modelrx.Oculus_Sinister_Add      = _detail.Element("oculus_sinister_add").Value.GetDecimalStr();
                        //
                        modelrx.Oculus_Dexter_Diameter   = _detail.Element("oculus_dexter_diameter").Value.GetIntFromStr();
                        modelrx.Oculus_Sinister_Diameter = _detail.Element("oculus_sinister_diameter").Value.GetIntFromStr();
                        //
                        modelrx.Oculus_Dexter_Quantity   = _detail.Element("oculus_dexter_quantity").Value.GetIntFromStr();
                        modelrx.Oculus_Sinister_Quantity = _detail.Element("oculus_sinister_quantity").Value.GetIntFromStr();

                        //new column
                        try { modelrx.Frame_Code = _detail.Element("frame_code").Value; }
                        catch { modelrx.Frame_Code = ""; }
                        try { modelrx.Polishing = _detail.Element("polishing").Value; }
                        catch { modelrx.Polishing = ""; }
                        try { modelrx.Oculus_Eye_Point = _detail.Element("oculus_eye_point").Value; }
                        catch { modelrx.Oculus_Eye_Point = ""; }
                        try { modelrx.Oculus_Dexter_Pupillary_Distance = _detail.Element("oculus_dexter_pupillary_distance").Value; }
                        catch { modelrx.Oculus_Dexter_Pupillary_Distance = ""; }
                        try { modelrx.Oculus_Sinister_Pupillary_Distance = _detail.Element("oculus_sinister_pupillary_distance").Value; }
                        catch { modelrx.Oculus_Sinister_Pupillary_Distance = ""; }

                        break;

                    default:

                        model.SubST = new List <OrdST>();
                        var   modelst = model.SubST;
                        OrdST ordst   = null;
                        var   details = _XElement.Elements("detail");
                        foreach (var item in details)
                        {
                            ordst = new OrdST()
                            {
                                SubID = item.Attribute("id").Value.GetIntFromStr(),
                                OPC   = item.Element("opc").Value,
                                Qty   = item.Element("qty").Value.GetIntFromStr(),
                            };
                            modelst.Add(ordst);
                        }
                        break;
                    }
                }
                //ordz
                InitOrdZ(model);
                //ordzmain
                InitOrdZMain(model);

                return(model);
            }
            catch (Exception ex)
            {
                Jinsdb.AddLog(ex.Message);
                throw;
            }
        }