Exemple #1
0
        public bool AddCmdList(List<Prod_CmdDetail> cmdDetailList, Prod_Command command)
        {
            bool flag = true;

            List<Prod_CmdDetail> oldSIList = GetByCommand(command.Cmd_Code);

            try
            {
                foreach (Prod_CmdDetail r in oldSIList)
                {
                    var temp = cmdDetailList.FirstOrDefault(o => o.CmdDetail_ID == r.CmdDetail_ID);
                    //如果存在则更新
                    if (temp != null)
                    {
                        Update(temp);
                        cmdDetailList.Remove(temp);

                    }//不存在则删除
                    else
                    {
                        Delete(r);
                    }
                }

                foreach (Prod_CmdDetail detail in cmdDetailList)
                {
                    detail.CreateTime = DateTime.Now;
                    //如果有编码生成,则在此处完成
                    instance.Add(detail);
                }

            }
            catch
            {
                flag = false;
            }
            return flag;
        }
Exemple #2
0
 /// <summary>
 /// 根据Key获取数据
 /// </summary>
 /// <param name="Id"></param>
 /// <returns></returns>
 public Prod_Command GetByKey(long Id)
 {
     Prod_Command model = new Prod_Command();
     model = instance.GetByKey(Id);
     return model;
 }
Exemple #3
0
 /// <summary>
 /// 更新数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Update(Prod_Command model)
 {
     bool result = false;
     int _rseult = instance.Update(model);
     if (_rseult > 0)
     {
         result = true;
     }
     return result;
 }
Exemple #4
0
 /// <summary>
 /// 插入数据 并返回数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public long InsertWithReturnId(Prod_Command model)
 {
     long result = 0;
     object _result = instance.AddWithReturn(model);
     if (_result != null)
     {
         long.TryParse(_result.ToString(), out result);
     }
     return result;
 }
Exemple #5
0
 /// <summary>
 /// 插入数据
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public bool Insert(Prod_Command model)
 {
     bool result = false;
     try
     {
         int _result = instance.Add(model);
         if (_result > 0)
         {
             result = true;
         }
     }
     catch (Exception ex)
     {
     }
     return result;
 }
Exemple #6
0
 /// <summary>
 /// 获取实体数据
 /// </summary>
 /// <param name="strCondition"></param>
 /// <returns></returns>
 public Prod_Command GetModel(string strCondition)
 {
     List<Prod_Command> list = instance.GetListByWhere(strCondition);
     Prod_Command model = new Prod_Command();
     if (list != null && list.Count > 0)
     {
         model = list[0];
     }
     return model;
 }