Exemple #1
0
        ///<summary>
        /// 得到当前是新增状态还是修改状态
        /// </summary>
        /// <param name="pObj">信息集实例</param>
        /// <returns>返回True或False</returns>
        public bool SaveStatus(Depot pObj)
        {
            CommonInterface pComm = CommonFactory.CreateInstance(CommonData.sql);

            try
            {
                string pSql = "";
                pSql = "SELECT DepotGuid   FROM   Depot  " +
                       "where DepotGuid  ='" + pObj.DepotGuid + "'";
                DataTable pDT = pComm.ExeForDtl(pSql);
                pComm.Close();
                if (pDT.Rows.Count > 0)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            catch (Exception e)
            {
                pComm.Close();
                throw e;
            }
        }
Exemple #2
0
 ///<summary>
 /// 保存数据
 /// </summary>
 /// <param name="pObj">信息集实体类</param>
 /// <returns>返回保存成功(true)或失败(false)</returns>
 public bool Save(Depot pObj)
 {
     try
     {
         if (SaveStatus(pObj) == false)
         {
             return(pObj.Add());
         }
         else
         {
             return(pObj.Update());
         }
     }
     catch (Exception e)
     {
         throw e;
     }
 }