示例#1
0
        public BaseOutput GetCALLModels(out List <CALLModel> callModels)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            BaseOutput    baseOutput;

            callModels = null;
            try
            {
                List <tbl_CALLModel> tbl_CALLModels = cRUDOperation.GetCALLModels();
                callModels = new List <CALLModel>();

                if (tbl_CALLModels.Count > 0)
                {
                    foreach (var item in tbl_CALLModels)
                    {
                        CALLModel callModel = new CALLModel()
                        {
                            ID                   = item.ID,
                            UserID               = item.UserID,
                            TotalCallCount       = item.TotalCallCount,
                            OutCallCount         = item.OutCallCount,
                            OutCallSecond        = item.OutCallSecond,
                            InCallCount          = item.InCallCount,
                            InCallSecond         = item.InCallSecond,
                            MissedCallCount      = item.MissedCallCount,
                            OutCallForeignCount  = item.OutCallForeignCount,
                            OutCallForeignSecond = item.OutCallForeignSecond,
                            InCallForeignCount   = item.InCallForeignCount,
                            InCallForeignSecond  = item.InCallForeignSecond,
                            OutCallRoamingCount  = item.OutCallRoamingCount,
                            OutCallRoamingSecond = item.OutCallRoamingSecond,
                            InCallRoamingCount   = item.InCallRoamingCount,
                            InCallRoamingSecond  = item.InCallRoamingSecond,
                            BeginDate            = item.BeginDate,
                            EndDate              = item.EndDate
                        };

                        List <tbl_CALLDetail> tbl_CALLDetails = cRUDOperation.GetCALLDetailsByModelID(callModel.ID);


                        callModel.CALLDetails = tbl_CALLDetails;
                        callModels.Add(callModel);
                    }
                }
                return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
            }
            catch (Exception ex)
            {
                return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message));
            }
        }
示例#2
0
        public IHttpActionResult GetLastCALLModelByUserName(string userName)
        {
            BusinessOperation businessOperation = new BusinessOperation();
            CALLModel         itemOut           = null;
            BaseOutput        baseOutput        = businessOperation.GetLastCALLModelByUserName(userName, out itemOut);

            if (baseOutput.ResultCode == 1)
            {
                return(Ok(itemOut));
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, baseOutput));
            }
        }
示例#3
0
        public IHttpActionResult GetCALLModelWithDetailByID(Int64 id)
        {
            BusinessOperation businessOperation = new BusinessOperation();
            CALLModel         itemOut           = null;
            BaseOutput        baseOutput        = businessOperation.GetCALLModelsByID(id, out itemOut);

            if (baseOutput.ResultCode == 1)
            {
                return(Ok(itemOut));
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, baseOutput));
            }
        }
示例#4
0
        public BaseOutput UpdateCALLModel(CALLModel item)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            BaseOutput    baseOutput;

            try
            {
                tbl_CALLModel tblCALLModel = new tbl_CALLModel()
                {
                    ID                   = item.ID,
                    UserID               = item.UserID,
                    TotalCallCount       = item.TotalCallCount,
                    OutCallCount         = item.OutCallCount,
                    OutCallSecond        = item.OutCallSecond,
                    InCallCount          = item.InCallCount,
                    InCallSecond         = item.InCallSecond,
                    MissedCallCount      = item.MissedCallCount,
                    OutCallForeignCount  = item.OutCallForeignCount,
                    OutCallForeignSecond = item.OutCallForeignSecond,
                    InCallForeignCount   = item.InCallForeignCount,
                    InCallForeignSecond  = item.InCallForeignSecond,
                    OutCallRoamingCount  = item.OutCallRoamingCount,
                    OutCallRoamingSecond = item.OutCallRoamingSecond,
                    InCallRoamingCount   = item.InCallRoamingCount,
                    InCallRoamingSecond  = item.InCallRoamingSecond,
                    BeginDate            = item.BeginDate,
                    EndDate              = item.EndDate,
                };

                tbl_CALLModel _CALLModel = cRUDOperation.UpdateCALLModel(tblCALLModel);

                if (_CALLModel != null)
                {
                    foreach (var callDetail in item.CALLDetails)
                    {
                        tbl_CALLDetail tblCALLDetail = cRUDOperation.UpdateCALLDetail(callDetail);
                    }
                }
                return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
            }
            catch (Exception ex)
            {
                return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message));
            }
        }
示例#5
0
        public IHttpActionResult AddCALLModelWithDetail(CALLModel item)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            BusinessOperation businessOperation = new BusinessOperation();

            BaseOutput baseOutput = businessOperation.AddCALLModel(item);

            if (baseOutput.ResultCode == 1)
            {
                return(Ok());
            }
            else
            {
                return(Content(HttpStatusCode.BadRequest, baseOutput));
            }
        }
示例#6
0
        public BaseOutput AddCALLModel(CALLModel item)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            BaseOutput    baseOutput;


            try
            {
                tbl_CALLModel callModel = new tbl_CALLModel()
                {
                    UserID               = item.UserID,
                    TotalCallCount       = item.TotalCallCount,
                    OutCallCount         = item.OutCallCount,
                    OutCallSecond        = item.OutCallSecond,
                    InCallCount          = item.InCallCount,
                    InCallSecond         = item.InCallSecond,
                    MissedCallCount      = item.MissedCallCount,
                    OutCallForeignCount  = item.OutCallForeignCount,
                    OutCallForeignSecond = item.OutCallForeignSecond,
                    InCallForeignCount   = item.InCallForeignCount,
                    InCallForeignSecond  = item.InCallForeignSecond,
                    OutCallRoamingCount  = item.OutCallRoamingCount,
                    OutCallRoamingSecond = item.OutCallRoamingSecond,
                    InCallRoamingCount   = item.InCallRoamingCount,
                    InCallRoamingSecond  = item.InCallRoamingSecond,
                    BeginDate            = item.BeginDate,
                    EndDate              = item.EndDate,
                };

                List <tbl_CALLDetail> tblCALLDetails = new List <tbl_CALLDetail>();

                tblCALLDetails = item.CALLDetails;
                tbl_CALLModel _CALLModel = cRUDOperation.AddCALLModel(callModel, tblCALLDetails);
                return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
            }
            catch (Exception ex)
            {
                return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message));
            }
        }
示例#7
0
        public BaseOutput GetLastCALLModelByUserName(string userName, out CALLModel callModel)
        {
            CRUDOperation cRUDOperation = new CRUDOperation();
            BaseOutput    baseOutput;

            callModel = null;
            try
            {
                tbl_CALLModel item = cRUDOperation.GetLastCALLModelByUserName(userName);
                if (item != null)
                {
                    callModel = new CALLModel()
                    {
                        ID                   = item.ID,
                        UserID               = item.UserID,
                        TotalCallCount       = item.TotalCallCount,
                        OutCallCount         = item.OutCallCount,
                        OutCallSecond        = item.OutCallSecond,
                        InCallCount          = item.InCallCount,
                        InCallSecond         = item.InCallSecond,
                        MissedCallCount      = item.MissedCallCount,
                        OutCallForeignCount  = item.OutCallForeignCount,
                        OutCallForeignSecond = item.OutCallForeignSecond,
                        InCallForeignCount   = item.InCallForeignCount,
                        InCallForeignSecond  = item.InCallForeignSecond,
                        OutCallRoamingCount  = item.OutCallRoamingCount,
                        OutCallRoamingSecond = item.OutCallRoamingSecond,
                        InCallRoamingCount   = item.InCallRoamingCount,
                        InCallRoamingSecond  = item.InCallRoamingSecond,
                        BeginDate            = item.BeginDate,
                        EndDate              = item.EndDate
                    };
                }
                return(baseOutput = new BaseOutput(true, BOResultTypes.Success.GetHashCode(), BOBaseOutputResponse.SuccessResponse, ""));
            }
            catch (Exception ex)
            {
                return(baseOutput = new BaseOutput(false, BOResultTypes.Danger.GetHashCode(), BOBaseOutputResponse.DangerResponse, ex.Message));
            }
        }
示例#8
0
 public CALLViewModel()
 {
     TopTextBlock.Text = InstructionName;
     Model             = new CALLModel();
 }