Beispiel #1
0
 public static void DeletePBSType(string PBSTypeCode)
 {
     try
     {
         if (PBSTypeCode != "")
         {
             PBSDAO.DeletePBSType(PBSDAO.GetPBSTypeAllChildByParentCode(PBSTypeCode));
             EntityData entity = PBSDAO.GetPBSTypeByCode(PBSTypeCode);
             PBSDAO.DeletePBSType(entity);
             entity.Dispose();
         }
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Beispiel #2
0
        public static string GetPBSTypeName(object PBSTypeCode)
        {
            string text2;

            try
            {
                string text = "";
                if ((PBSTypeCode != null) && (PBSTypeCode.ToString() != ""))
                {
                    EntityData pBSTypeByCode = PBSDAO.GetPBSTypeByCode(PBSTypeCode.ToString());
                    if (pBSTypeByCode.HasRecord())
                    {
                        text = pBSTypeByCode.GetString("PBSTypeName");
                    }
                    pBSTypeByCode.Dispose();
                }
                text2 = text;
            }
            catch (Exception exception)
            {
                throw exception;
            }
            return(text2);
        }
Beispiel #3
0
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="code"></param>
        /// <param name="parentCode"></param>
        private void SavaData(string code, string parentCode)
        {
            try
            {
                string curCode = "";

                int    deep   = 0;
                string fullID = "";
                int    sortID = 0;

                if (parentCode.Length > 0)
                {
                    EntityData entityParent = PBSDAO.GetPBSTypeByCode(parentCode);
                    if (entityParent.HasRecord())
                    {
                        deep   = entityParent.GetInt("Deep");
                        fullID = entityParent.GetString("fullID");
                    }
                    entityParent.Dispose();
                }


                EntityData entity = RmsPM.DAL.EntityDAO.PBSDAO.GetPBSTypeByCode(code);
                DataRow    dr     = null;
                bool       IsNew  = false;

                if (entity.HasRecord())
                {
                    IsNew = false;
                    dr    = entity.CurrentRow;
                }
                else
                {
                    dr                = entity.GetNewRecord();
                    IsNew             = true;
                    curCode           = SystemManageDAO.GetNewSysCode("PBSTypeCode");
                    sortID            = PBSDAO.GetPBSTypeMaxSortID(this.txtProjectCode.Value, parentCode);
                    dr["PBSTypeCode"] = curCode;
                    dr["Deep"]        = deep + 1;
                    if (fullID.Length > 0)
                    {
                        dr["FullID"] = fullID + "-" + curCode;
                    }
                    else
                    {
                        dr["FullID"] = curCode;
                    }
                    dr["ParentCode"]  = parentCode;
                    dr["ProjectCode"] = this.txtProjectCode.Value;
                    dr["SortID"]      = sortID + 1;
                }


                dr["PBSTypeName"] = this.txtPBSTypeName.Value;
                dr["Description"] = this.txtDescription.Value;

                if (IsNew)
                {
                    entity.AddNewRecord(dr);
                    PBSDAO.InsertPBSType(entity);
                }
                else
                {
                    PBSDAO.UpdatePBSType(entity);
                }

                entity.Dispose();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }