示例#1
0
 public PositionData GetData(double loid)
 {
     PositionData data = new PositionData();
     if (SearchDAL.GetDataByLOID(loid, null))
     {
         data.LOID = SearchDAL.LOID;
         data.CODE = SearchDAL.CODE;
         data.NAME = SearchDAL.NAME;
     }
     return data;
 }
示例#2
0
        public bool UpdateData(string userID, PositionData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    SearchDAL.GetDataByLOID(data.LOID, obj.zTrans);
                    SearchDAL.LOID = data.LOID;
                    SearchDAL.NAME = data.NAME.Trim();
                    SearchDAL.CODE = data.CODE.Trim();

                    if (SearchDAL.OnDB)
                        ret = SearchDAL.UpdateCurrentData(userID, obj.zTrans);
                    else
                        ret = SearchDAL.InsertCurrentData(userID, obj.zTrans);

                    _LOID = SearchDAL.LOID;

                    if (ret)
                    {
                        obj.zTrans.Commit();
                        obj.CloseConnection();
                    }
                    else
                    {
                        _error = SearchDAL.ErrorMessage;
                    }
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    throw new ApplicationException(ex.Message);
                }
            }
            else
                ret = false;
            return ret;
        }
示例#3
0
 private bool VeridateData(PositionData data)
 {
     bool ret = true;
     if (data.CODE.Trim() == "")
     {
         _error = "��س��к�����";
         ret = false;
     }
     else if (data.NAME.Trim() == "")
     {
         _error = "��س��кت���˹��§ҹ";
         ret = false;
     }
     else if (SearchDAL.CheckCode(data.LOID, data.CODE.Trim()) == false)
     {
         _error = "����˹��§ҹ�������������";
         ret = false;
     }
     else if (SearchDAL.CheckName(data.LOID, data.NAME.Trim()) == false)
     {
         _error = "����˹��§ҹ�������������";
         ret = false;
     }
     return ret;
 }