예제 #1
0
        public bool UpdateData(string userID, ArrayList arrData)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                for (int i = 0; i < arrData.Count; ++i)
                {
                    ProductStockAdjustData data = (ProductStockAdjustData)arrData[i];
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.QTY = data.QTY;
                    if (DALObj.OnDB)
                        ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                    if (!ret) throw new ApplicationException(DALObj.ErrorMessage);
                }

                obj.zTrans.Commit();
                obj.zConn.Close();
            }
            catch (Exception ex)
            {
                ret = false;
                _error = ex.Message;
                obj.zTrans.Rollback();
                obj.zConn.Close();
            }
            return ret;
        }
예제 #2
0
        public bool UpdateData(string userID, double loid, double qty)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                DALObj.GetDataByLOID(loid, obj.zTrans);
                DALObj.QTY = qty;
                if (DALObj.OnDB)
                    ret = DALObj.UpdateCurrentData(userID, obj.zTrans);
                if (!ret) throw new ApplicationException(DALObj.ErrorMessage);

                obj.zTrans.Commit();
                obj.zConn.Close();
            }
            catch (Exception ex)
            {
                ret = false;
                _error = ex.Message;
                obj.zTrans.Rollback();
                obj.zConn.Close();
            }
            return ret;
        }
예제 #3
0
        public bool UpdateData(string userID, SysConfigData data)
        {
            bool ret = true;
            if (ValidateData(data))
            {
                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    DALObj.GetDataByLOID(data.LOID, obj.zTrans);
                    DALObj.CONFIGNAME = data.CONFIGNAME.Trim();
                    DALObj.CONFIGVALUE = data.CONFIGVALUE;
                    DALObj.DESCRIPTION = data.DESCRIPTION.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;
        }
예제 #4
0
파일: AppFlow.cs 프로젝트: SoftSuite/ABB
        public bool ChangePassword(double officerID, string newPassword)
        {
            bool ret = true;
            OfficerDAL offDAL = new OfficerDAL();
            OracleDBObj obj = new OracleDBObj();
            obj.CreateConnection();
            obj.CreateTransaction();
            try
            {
                offDAL.GetDataByLOID(officerID, obj.zTrans);
                offDAL.PASSWORD = Encrypt(newPassword);

                if (offDAL.OnDB)
                    offDAL.UpdateCurrentData(offDAL.USERID, obj.zTrans);
                else
                    throw new ApplicationException("��辺�����Ţͧ��ҹ��к�");

                obj.zTrans.Commit();
                obj.zConn.Close();
            }
            catch (Exception ex)
            {
                ret = false;
                _error = ex.Message;
                obj.zTrans.Rollback();
                obj.zConn.Close();
            }
            return ret;
        }
예제 #5
0
파일: UserFlow.cs 프로젝트: SoftSuite/ABB
        public bool SaveRoleMenu(string UserID, string RoleID, ArrayList arrMenu)
        {
            bool ret = true;
            OracleDBObj zObj = new OracleDBObj();
            zObj.CreateTransaction();

            try
            {
                string sqlz = "";
                sqlz = " DELETE FROM ZROLEASSIGN WHERE ZROLE = " + RoleID + " ";
                OracleDB.ExecNonQueryCmd(sqlz, zObj.zTrans);
                for (int i = 0; i < arrMenu.Count; i++)
                {
                    sqlz = " INSERT INTO ZROLEASSIGN (ZROLE, ZMENU, CREATEBY) VALUES (" + RoleID + ", " + arrMenu[i].ToString() + ", '" + OracleDB.QRText(UserID) + "' ) ";
                    OracleDB.ExecNonQueryCmd(sqlz, zObj.zTrans);
                }
                zObj.zTrans.Commit();
            }
            catch (Exception ex)
            {
                zObj.zTrans.Rollback();
                _error = "Error while save user menu data. " + ex.Message;
                ret = false;
            }

            zObj.CloseConnection();
            return ret;
        }
예제 #6
0
파일: UserFlow.cs 프로젝트: SoftSuite/ABB
        public bool DeleteGroup(ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateTransaction();
            string sql = "";
            try
            {
                for (int i = 0; i < arrLOID.Count; ++i)
                {
                    string[] arr = arrLOID[i].ToString().Split('#');
                    sql = "SELECT COUNT(ZROLE) FROM ZROLEREF WHERE PARENT = " + arr[0];
                    if (Convert.ToDouble(OracleDB.ExecSingleCmd(sql, obj.zTrans)) > 0)
                    {
                        throw new ApplicationException("äÁèÊÒÁÒöź¡ÅØèÁ¼Ùéãªé§Ò¹ '" + arr[1] + "' ä´é à¹×èͧ¨Ò¡ÁÕ¡ÒáÓ˹´ÊÔ·¸Ôì¼Ùéãªé§Ò¹¡ÅØèÁ¹Õé");
                    }
                    else
                    {
                        sql = "DELETE FROM ZROLEASSIGN WHERE ZROLE = " + arr[0];
                        OracleDB.ExecNonQueryCmd(sql, obj.zTrans);
                        sql = "DELETE FROM ZROLE WHERE LOID = " + arr[0];
                        OracleDB.ExecNonQueryCmd(sql, obj.zTrans);
                    }
                }
                obj.zTrans.Commit();
                obj.zConn.Close();
            }
            catch (Exception ex)
            {
                _error = ex.Message;
                ret = false;
                obj.zTrans.Rollback();
                obj.zConn.Close();
            }

            return ret;
        }
예제 #7
0
파일: UserFlow.cs 프로젝트: SoftSuite/ABB
        public bool InvokeRole(ArrayList arrLOID)
        {
            bool ret = true;
            OracleDBObj obj = new OracleDBObj();
            obj.CreateTransaction();
            string sql = "";
            try
            {
                for (int i = 0; i < arrLOID.Count; ++i)
                {
                    sql = "DELETE FROM ZROLEASSIGN WHERE ZROLE = " + arrLOID[i].ToString();
                    OracleDB.ExecNonQueryCmd(sql, obj.zTrans);
                    sql = "DELETE FROM ZROLEREF WHERE ZROLE = " + arrLOID[i].ToString();
                    OracleDB.ExecNonQueryCmd(sql, obj.zTrans);
                    sql = "DELETE FROM ZROLE WHERE LOID = " + arrLOID[i].ToString();
                    OracleDB.ExecNonQueryCmd(sql, obj.zTrans);
                }
                obj.zTrans.Commit();
                obj.zConn.Close();
            }
            catch (Exception ex)
            {
                _error = ex.Message;
                ret = false;
                obj.zTrans.Rollback();
                obj.zConn.Close();
            }

            return ret;
        }
예제 #8
0
        public bool UpdateData(string userID, OfficerData data)
        {
            bool ret = true;
            if (VeridateData(data))
            {

                OracleDBObj obj = new OracleDBObj();
                obj.CreateConnection();
                obj.CreateTransaction();
                try
                {
                    SearchDAL.OnDB = false;
                    SearchDAL.GetDataByLOID(data.LOID, obj.zTrans);
                    SearchDAL.TNAME = data.TNAME.Trim();
                    SearchDAL.LASTNAME = data.LASTNAME.Trim();
                    SearchDAL.DIVISION = data.DIVISION;
                    SearchDAL.USERID = data.USERID;
                    SearchDAL.PASSWORD = AppFlow.Encrypt(data.PASSWORD);
                    SearchDAL.EFDATE = data.EFDATE;
                    SearchDAL.NICKNAME = data.NICKNAME;
                    SearchDAL.BIRTHDATE = data.BIRTHDATE;
                    SearchDAL.TEL = data.TEL;
                    SearchDAL.EMAIL = data.EMAIL;
                    SearchDAL.ADDRESS = data.ADDRESS;
                    SearchDAL.ROAD = data.ROAD;
                    SearchDAL.PROVINCE = data.PROVINCE;
                    SearchDAL.AMPHUR = data.AMPHUR;
                    SearchDAL.TAMBOL = data.TAMBOL;
                    SearchDAL.ZIPCODE = data.ZIPCODE;
                    SearchDAL.REMARK = data.REMARK;
                    SearchDAL.TITLE = data.TITLE;
                    
                    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;
        }
예제 #9
0
 public bool DeleteData(ArrayList arrData)
 {
     bool ret = true;
     OracleDBObj obj = new OracleDBObj();
     obj.CreateConnection();
     obj.CreateTransaction();
     try
     {
         OfficerPositionDAL opDAL = new OfficerPositionDAL();
         for (int i = 0; i < arrData.Count; i++)
         {
             SearchDAL.GetDataByLOID(Convert.ToDouble(arrData[i]), obj.zTrans);
             opDAL.DeleteDataByOfficer(Convert.ToDouble(arrData[i]), obj.zTrans);
             ret = SearchDAL.DeleteCurrentData(obj.zTrans);
             if (!ret)
             {
                 throw new ApplicationException(SearchDAL.ErrorMessage);
             }
         }
         obj.zTrans.Commit();
         obj.CloseConnection();
     }
     catch (Exception ex)
     {
         obj.zTrans.Rollback();
         obj.CloseConnection();
         ret = false;
         _error = ex.Message;
     }
     return ret;
 }