コード例 #1
0
        /// <summary>
        /// 归口项目对应部门设置关系的改变
        /// </summary>
        /// <returns></returns>
        public SavedResult <Int64> UpdateGKXM(List <long> mydelete, List <CorrespondenceSettings2Model> myinsert)
        {
            List <CorrespondenceSettings2Model> data = new List <CorrespondenceSettings2Model>();

            if (mydelete.Count > 0)
            {
                foreach (var deletephid in mydelete)
                {
                    CorrespondenceSettings2Model a = CorrespondenceSettings2Facade.Find(deletephid).Data;
                    a.PersistentState = PersistentState.Deleted;
                    data.Add(a);
                }
            }
            if (myinsert.Count > 0)
            {
                foreach (var insert in myinsert)
                {
                    insert.PersistentState = PersistentState.Added;
                    data.Add(insert);
                }
            }
            SavedResult <Int64> result = CorrespondenceSettings2Facade.Save <Int64>(data, "");

            return(result);
        }
コード例 #2
0
        /// <summary>
        /// 归口项目对应部门设置关系的改变
        /// </summary>
        /// <returns></returns>
        public SavedResult <Int64> SaveJXJLset(List <CorrespondenceSettings2Model> updateinfo, List <string> deleteinfo)
        {
            List <CorrespondenceSettings2Model> savedata = new List <CorrespondenceSettings2Model>();

            if (updateinfo.Count > 0)
            {
                foreach (CorrespondenceSettings2Model a in updateinfo)
                {
                    if (a.PhId == 0)
                    {
                        CorrespondenceSettings2Model data = a;
                        data.PersistentState = PersistentState.Added;
                        savedata.Add(data);
                    }
                    else
                    {
                        CorrespondenceSettings2Model data = CorrespondenceSettings2Facade.Find(a.PhId).Data;
                        data.DefStr1         = a.DefStr1;
                        data.DefStr2         = a.DefStr2;
                        data.DefStr3         = a.DefStr3;
                        data.PersistentState = PersistentState.Modified;
                        savedata.Add(data);
                    }
                }
            }
            if (deleteinfo.Count > 0)
            {
                foreach (string b in deleteinfo)
                {
                    if (!string.IsNullOrEmpty(b))
                    {
                        CorrespondenceSettings2Model data = CorrespondenceSettings2Facade.Find(long.Parse(b)).Data;
                        data.PersistentState = PersistentState.Deleted;
                        savedata.Add(data);
                    }
                }
            }
            SavedResult <Int64> result = CorrespondenceSettings2Facade.Save <Int64>(savedata, "");

            return(result);
        }