Beispiel #1
0
        public void Load()
        {
            //            _fileName = fileName;
            //XmlSerializer serializer = new XmlSerializer(typeof(RptAgronomy));

            // A FileStream is needed to read the XML document.
            // Declare an object variable of the type to be deserialized.
            RptAgronomy rptAgronomy = new RptAgronomy();

            /* Use the Deserialize method to restore the object's state with
             * data from the XML document. */

            //using (FileStream fs = new FileStream(fileName, FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)) {
            //    rptAgronomy = (RptAgronomy)serializer.Deserialize(fs);
            //}

            //this._varietyList = rptAgronomy.VarietyList;
            //this._factoryVarietyList = rptAgronomy.FactoryVarietyList;

            GetFactoryAreaList();
            GetSeedVarietyList();
            GetSeedListList();
            GetSeedTreatmentList();
            GetLaybyHerbicideList();
            GetBandWidthList();
            GetSampleDepthList();
            GetSamplePList();
            GetPlantSpacingList();
            GetRowSpacingList();
            GetSoilTextureList();
            GetSoilSampleList();
            GetCercosporaChemList();
            GetHailStressList();
            GetWeedControlList();
            GetReplantReasonList();
            GetLostReasonList();
            GetHerbicideRxCountList();
        }
Beispiel #2
0
        public static RptAgronomy GetAgronomyData()
        {
            const string METHOD_NAME = "GetAgronomyData";
            RptAgronomy agronomy = null;
            try {

                System.Web.Caching.Cache cache = System.Web.HttpContext.Current.Cache;
                agronomy = cache["RptAgronomy"] as RptAgronomy;
                if (agronomy == null) {

                    agronomy = new RptAgronomy();
                    //agronomy.Load(WSCI.Common.AppHelper.AppPath() + @"ZHost/XML/RptAgronomy.xml");
                    agronomy.Load();
                    //AppDomain.CurrentDomain.SetData("RptAgronomy", agronomy);
                    cache.Insert("RptAgronomy", agronomy, null, DateTime.Now.AddMinutes(15), TimeSpan.Zero);
                }
            }
            catch (Exception ex) {
                string errMsg = MOD_NAME + METHOD_NAME;
                WSCIEMP.Common.CException wscEx = new WSCIEMP.Common.CException(errMsg, ex);
                throw (wscEx);
            }
            return agronomy;
        }
Beispiel #3
0
        private static iTextSharp.text.Paragraph GetSeedsAsText(RptAgronomy agronomy, string factoryNumber,
            Font labelFont, Font normalFont, bool underline)
        {
            string varietyType = "";
            string label = "";

            const int MaxItemsPerLine = 12;

            iTextSharp.text.Paragraph para = new Paragraph();
            iTextSharp.text.Phrase p = null;
            int lineCount = 0;

            if (factoryNumber.Length > 0) {

                // Given the factory number look up whether this is a north or south variety.
                foreach (TItem2 item in agronomy.FactoryVarietyList.Items) {
                    if (item.Field1 == factoryNumber) {
                        varietyType = item.Field2;
                        break;
                    }
                }

                if (varietyType.Length > 0) {
                    label = varietyType.Substring(0, 1).ToUpper() + varietyType.Substring(1).ToLower() + " ";
                }

                if (label.Length > 0) {
                    p = new Phrase(label, labelFont);
                    para.Add(p);
                    p = null;
                    lineCount++;
                }

                foreach (TItem2 item in agronomy.VarietyList.Items) {
                    if (item.Field1 == varietyType) {

                        if (p != null) {
                            p = new Phrase(@" \ " + item.Field2, normalFont);
                        } else {
                            p = new Phrase(item.Field2, normalFont);
                        }
                        para.Add(p);
                        lineCount++;

                        if (lineCount == MaxItemsPerLine) {
                            p = new Phrase("\n", normalFont);
                            para.Add(p);
                            lineCount = 0;
                        }
                    }
                }

                p = new Phrase("\n ", normalFont);
                para.Add(p);
            }

            return para;
        }
Beispiel #4
0
        public void Load()
        {
            //            _fileName = fileName;
            //XmlSerializer serializer = new XmlSerializer(typeof(RptAgronomy));

            // A FileStream is needed to read the XML document.
            // Declare an object variable of the type to be deserialized.
            RptAgronomy rptAgronomy = new RptAgronomy();

            /* Use the Deserialize method to restore the object's state with
            data from the XML document. */

            //using (FileStream fs = new FileStream(fileName, FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read)) {
            //    rptAgronomy = (RptAgronomy)serializer.Deserialize(fs);
            //}

            //this._varietyList = rptAgronomy.VarietyList;
            //this._factoryVarietyList = rptAgronomy.FactoryVarietyList;

            GetFactoryAreaList();
            GetSeedVarietyList();
            GetSeedListList();
            GetSeedTreatmentList();
            GetLaybyHerbicideList();
            GetBandWidthList();
            GetSampleDepthList();
            GetSamplePList();
            GetPlantSpacingList();
            GetRowSpacingList();
            GetSoilTextureList();
            GetSoilSampleList();
            GetCercosporaChemList();
            GetHailStressList();
            GetWeedControlList();
            GetReplantReasonList();
            GetLostReasonList();
            GetHerbicideRxCountList();
        }