Ejemplo n.º 1
0
 public TitleData GetData(double loid)
 {
     TitleData data = new TitleData();
     if (DALObj.GetDataByLOID(loid, null))
     {
         data.ACTIVE = DALObj.ACTIVE;
         data.CODE = DALObj.CODE;
         data.LOID = DALObj.LOID;
         data.NAME = DALObj.NAME;
     }
     return data;
 }
Ejemplo n.º 2
0
 private bool ValidateData(TitleData data)
 {
     bool ret = true;
     if (data.CODE.Trim() == "")
     {
         ret = false;
         _error = "¡ÃسÒÃкØÃËÑʤӹÓ˹éÒª×èÍ";
     }
     else if (data.NAME.Trim() == "")
     {
         _error = "¡ÃسÒÃкؤӹÓ˹éÒª×èÍ";
     }
     return ret;
 }
Ejemplo n.º 3
0
        public bool UpdateData(string userID, TitleData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.NAME = data.NAME.Trim();
                    DALObj.ACTIVE = data.ACTIVE.Trim();
                    DALObj.CODE = data.CODE.Trim();

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

                    if (!ret)
                    {
                        throw new ApplicationException(DALObj.ErrorMessage);
                    }
                    obj.zTrans.Commit();
                    obj.CloseConnection();
                }
                catch (Exception ex)
                {
                    obj.zTrans.Rollback();
                    obj.CloseConnection();
                    ret = false;
                    _error = ex.Message;
                }
            }
            else
                ret = false;
            return ret;
        }