コード例 #1
0
        /// <summary>
        ///  Добавить или править
        /// </summary>
        /// <param name="MTConsignee"></param>
        /// <returns></returns>
        public int SaveMTConsignee(MTConsignee MTConsignee)
        {
            MTConsignee dbEntry;

            dbEntry = context_edit.MTConsignee.Find(MTConsignee.Code);
            if (dbEntry == null)
            {
                dbEntry = new MTConsignee()
                {
                    Code            = MTConsignee.Code,
                    CodeDescription = MTConsignee.CodeDescription,
                    Consignee       = MTConsignee.Consignee,
                };
                context_edit.MTConsignee.Add(dbEntry);
            }
            else
            {
                dbEntry.Code            = MTConsignee.Code;
                dbEntry.CodeDescription = MTConsignee.CodeDescription;
                dbEntry.Consignee       = MTConsignee.Consignee;
            }
            try
            {
                context_edit.SaveChanges();
            }
            catch (Exception e)
            {
                return(-1);
            }
            return(dbEntry.Code);
        }
コード例 #2
0
        /// <summary>
        /// Удалить
        /// </summary>
        /// <param name="Code"></param>
        /// <returns></returns>
        public MTConsignee DeleteMTConsignee(int Code)
        {
            MTConsignee dbEntry = context_edit.MTConsignee.Find(Code);

            if (dbEntry != null)
            {
                context_edit.MTConsignee.Remove(dbEntry);
                context_edit.SaveChanges();
            }
            return(dbEntry);
        }
コード例 #3
0
        public void Test_SUD_MTContent_MTConsignee()
        {
            MTContent   mt      = new MTContent();
            MTConsignee mtc3437 = new MTConsignee()
            {
                Code            = 3437,
                CodeDescription = "основной код ПАО АМКР",
                Consignee       = (int)tMTConsignee.AMKR
            };

            mt.SaveMTConsignee(mtc3437);
            MTConsignee mtc6302 = new MTConsignee()
            {
                Code            = 6302,
                CodeDescription = "вспомогательный код при отправке досылочных грузов (добавлен в регламент)",
                Consignee       = (int)tMTConsignee.AMKR
            };

            mt.SaveMTConsignee(mtc6302);
            MTConsignee mtc9999 = new MTConsignee()
            {
                Code            = 9999,
                CodeDescription = "вспомогательный код при отправке досылочных грузов (добавлен в регламент)",
                Consignee       = (int)tMTConsignee.AMKR
            };

            mt.SaveMTConsignee(mtc9999);
            MTConsignee mtc0 = new MTConsignee()
            {
                Code            = 0,
                CodeDescription = "0",
                Consignee       = (int)tMTConsignee.AMKR
            };
            int         mtc0_add = mt.SaveMTConsignee(mtc0);
            MTConsignee mtc1     = new MTConsignee()
            {
                Code            = mtc0_add,
                CodeDescription = "1",
                Consignee       = (int)tMTConsignee.AMKR
            };
            int del = mt.SaveMTConsignee(mtc1);

            MTConsignee mtc_del = mt.DeleteMTConsignee(del);
        }
コード例 #4
0
        /// <summary>
        /// Код пренадлежит грузополучателю
        /// </summary>
        /// <param name="Code"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public bool IsConsignee(int Code, tMTConsignee type)
        {
            MTConsignee mtc = MTConsignee(Code);

            return(mtc != null ? mtc.Consignee == (int)type ? true : false : false);
        }
コード例 #5
0
 public int SaveMTConsignee(MTConsignee mtconsignee)
 {
     return(rep_MT.SaveMTConsignee(mtconsignee));
 }