コード例 #1
0
 private void ThoaiDuyet()
 {
     try
     {
         HanMucProcess process = new HanMucProcess();
         int[]         arrayID = new int[0];
         Mouse.OverrideCursor = Cursors.Wait;
         try
         {
             foreach (DataRowView dr in grKhachHangDS.SelectedItems)
             {
                 Array.Resize(ref arrayID, arrayID.Length + 1);
                 arrayID[arrayID.Length - 1] = Convert.ToInt32(dr["ID"]);
             }
             HM_HMUC_TONG obj = new HM_HMUC_TONG();
             obj.lstID = arrayID;
             List <ClientResponseDetail>        lstResponseDetail = new List <ClientResponseDetail>();
             ApplicationConstant.ResponseStatus ret = process.HanMucTong(_function, DatabaseConstant.Action.THOAI_DUYET, ref obj, ref lstResponseDetail);
             CommonFunction.ThongBaoKetQua(lstResponseDetail);
             TimKiem();
         }
         catch (System.Exception ex)
         {
             this.Cursor = Cursors.Arrow;
             CommonFunction.ThongBaoLoi(ex);
             LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
         }
         Mouse.OverrideCursor = Cursors.Arrow;
     }
     catch (System.Exception ex)
     {
         CommonFunction.ThongBaoLoi(ex);
         LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
     }
 }
コード例 #2
0
        public ApplicationConstant.ResponseStatus HanMucTong(DatabaseConstant.Function function, DatabaseConstant.Action action, ref HM_HMUC_TONG obj, ref List <ClientResponseDetail> listClientResponseDetail)
        {
            HanMucServiceClient client   = null;
            HanMucRequest       request  = null;
            HanMucResponse      response = null;

            try
            {
                // Kiểm tra kết nối, server, service trước khi request
                Common.Utilities.IsRequestAllow(ApplicationConstant.SystemService.HanMucService.layGiaTri());

                client   = HanMucServiceClient(ApplicationConstant.SystemService.HanMucService);
                request  = Common.Utilities.PrepareRequest(new HanMucServiceRef.HanMucRequest());
                response = new HanMucServiceRef.HanMucResponse();

                //Khởi tạo request
                request.Function      = function;
                request.Action        = action;
                request.objHanMucTong = obj;

                // make a call to service client here
                response = client.HanMuc(request);

                //Kiểm tra kết quả trả về
                Common.Utilities.ValidResponse(request, response);

                if (response != null && response.ResponseStatus == ApplicationConstant.ResponseStatus.THANH_CONG)
                {
                    obj = response.objHanMucTong;
                    return(ApplicationConstant.ResponseStatus.THANH_CONG);
                }
                else
                {
                    listClientResponseDetail = Common.Utilities.convertToClientResponseDetail(response);
                    return(ApplicationConstant.ResponseStatus.KHONG_THANH_CONG);
                }
            }
            catch (Exception ex)
            {
                LLogging.WriteLog(System.Reflection.MethodInfo.GetCurrentMethod().ToString(), LLogging.LogType.ERR, ex);
                throw ex;
            }
            finally
            {
                if (client.State == CommunicationState.Faulted)
                {
                    client.Abort();
                }
                else
                {
                    client.Close();
                }

                client   = null;
                request  = null;
                response = null;
            }
        }