Esempio n. 1
0
        /// <summary>
        /// 修改站点
        /// </summary>
        public static void Update(CoSite site)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                //查找该站点是否存在
                CoSite _site = context.CoSite.FirstOrDefault(obj => obj.ID == site.ID);
                if (_site == null)
                    throw new FaultException(string.Format("该站点[{0}]不存在!", site.Name));
                if (_site.Code != site.Code && context.CoSite.Any(obj => obj.Code == site.Code && obj.Valid == true))
                    throw new FaultException(string.Format("站点编码[{0}]已存在!", site.Code));

                    EntityObjectHelper.Copyto(site, ref _site); //利用反射动态赋值

                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoSiteAdapter03", Define.Update, _site));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 新增站点
        /// </summary>
        public static void Insert(CoSite site)
        {
            try
            {
                LDLLogisticsEntities context = new LDLLogisticsEntities();
                //查找该站点是否存在
                if (context.CoSite.Any(obj => obj.Code == site.Code && obj.Valid == true))
                    throw new FaultException(string.Format("站点编码[{0}]已存在!", site.Code));
                //主键
                string maxID = site.ParentID + "00";
                if (context.CoSite.Count(obj => obj.ParentID == site.ParentID) > 0)
                    maxID = context.CoSite.Where(obj => obj.ParentID == site.ParentID).Max(obj => obj.ID);
                site.ID = (int.Parse(maxID) + 1).ToString();

                context.CoSite.AddObject(site);    //新增
                context.SysOperationLog.AddObject(SysOperationLogAdapter.GetOperationtLog("CoSiteAdapter01", Define.Insert, site));   //记录日志
                context.SaveChanges();  //提交保存
            }
            catch (Exception ex)
            {
                throw new FaultException(ex.Message);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 用于向 CoSite EntitySet 添加新对象的方法,已弃用。请考虑改用关联的 ObjectSet&lt;T&gt; 属性的 .Add 方法。
 /// </summary>
 public void AddToCoSite(CoSite coSite)
 {
     base.AddObject("CoSite", coSite);
 }
Esempio n. 4
0
 /// <summary>
 /// 创建新的 CoSite 对象。
 /// </summary>
 /// <param name="id">ID 属性的初始值。</param>
 /// <param name="parentID">ParentID 属性的初始值。</param>
 /// <param name="code">Code 属性的初始值。</param>
 /// <param name="name">Name 属性的初始值。</param>
 /// <param name="type">Type 属性的初始值。</param>
 /// <param name="currency">Currency 属性的初始值。</param>
 /// <param name="allowArrivalPay">AllowArrivalPay 属性的初始值。</param>
 /// <param name="allowCollection">AllowCollection 属性的初始值。</param>
 /// <param name="allowArrears">AllowArrears 属性的初始值。</param>
 /// <param name="valid">Valid 属性的初始值。</param>
 public static CoSite CreateCoSite(global::System.String id, global::System.String parentID, global::System.String code, global::System.String name, global::System.String type, global::System.String currency, global::System.Boolean allowArrivalPay, global::System.Boolean allowCollection, global::System.Boolean allowArrears, global::System.Boolean valid)
 {
     CoSite coSite = new CoSite();
     coSite.ID = id;
     coSite.ParentID = parentID;
     coSite.Code = code;
     coSite.Name = name;
     coSite.Type = type;
     coSite.Currency = currency;
     coSite.AllowArrivalPay = allowArrivalPay;
     coSite.AllowCollection = allowCollection;
     coSite.AllowArrears = allowArrears;
     coSite.Valid = valid;
     return coSite;
 }
Esempio n. 5
0
 public void UpdateSite(CoSite site)
 {
     CoSiteAdapter.Update(site);
 }
Esempio n. 6
0
 public void InsertSite(CoSite site)
 {
     CoSiteAdapter.Insert(site);
 }