public void Save()
        {
            if (Glob.IsDebugMode)
                return;

            if (id == null)
                SqlMapperExtensions.Insert(CnnMySQL, this, TranMySQL);
            else
                SqlMapperExtensions.Update(CnnMySQL, this, TranMySQL);

            WHTotal WHTotal = WHTotal.LoadMySQL(CnnMySQL, ItemNo, Warehouse);

            if (WHTotal == null)
            {
                WHTotal = new WHTotal();
                Item Item = Item.Load(ItemNo);
                WHTotal.ItemNo = ItemNo;
                if (Item != null)
                {
                    WHTotal.ItemName = Item.ItemName;
                    WHTotal.ItemType = Item.ItemType;
                }
                else
                {
                    WHTotal.ItemName = ItemName;
                    WHTotal.ItemType = ItemType;
                }
                WHTotal.Warehouse = Warehouse;
            }
            WHTotal.CnnMySQL = CnnMySQL;
            WHTotal.Save();
        }
Beispiel #2
0
        public static WHTotal LoadExchange(string ItemNo)
        {
            Logger.For(typeof(WHTotal)).Info(string.Format("开始.  编码 : {0}", ItemNo));
            ADODB.Connection Cnn = ServerHelper.ConnectExchange(SZInvPath);
            ADODB.Record Rst = new ADODB.Record();
            WHTotal WHTotal = new WHTotal();

            try
            {
                Rst.Open(string.Format("{0}{1}.eml", SZInvPath, ItemNo), Cnn, ADODB.ConnectModeEnum.adModeReadWrite, ADODB.RecordCreateOptionsEnum.adOpenIfExists, ADODB.RecordOpenOptionsEnum.adDelayFetchFields, "namwah", "ParaW0rld");
                WHTotal.InitFromExchange(Rst);
                Logger.For(typeof(WHTotal)).Info(string.Format("结束.  编码 : {0}", ItemNo));
            }
            catch (Exception ex)
            {
                Logger.For(typeof(WHTotal)).Error(string.Format("编码 {0} :  原因 : {1}.", ItemNo, ex.Message));
                return null;
            }

            return WHTotal;
        }