public HttpResponseMessage InsertOfficeBranchSales([FromBody] clsofficeBanchSales request)
        {
            LoggerFactory.LoggerInstance.LogDebug("Request Started for : " + request.BranchSalesID + "  Office branch Id :" + request.OfficeBranchID);
            HttpResponseMessage response = new HttpResponseMessage();

            try
            {
                office_branch_salesService objComService = new office_branch_salesService();
                var objResponse = objComService.InsertOfficeBranchSales(request);
                if (objResponse != null && objResponse.ToString() != "")
                {
                    response = Request.CreateResponse(HttpStatusCode.OK, objResponse);
                    LoggerFactory.LoggerInstance.LogDebug("Request End for : " + request.BranchSalesID + "  Office branch Id :" + request.OfficeBranchID);
                }
                else
                {
                    response = Request.CreateErrorResponse(HttpStatusCode.NotFound, "No detail found  for  Office branch Id : " + request.OfficeBranchID + ".");
                }
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                response = Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Error occured while getting  Office branch Id " + request.OfficeBranchID + ".");
            }
            return(response);
        }
        public virtual int DeleteOfficeBranchSales(clsofficeBanchSales obj)
        {
            int result = 0;

            try
            {
                result = (int)db.SP_office_branch_sales_Delete(obj.BranchSalesID);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }

            return(result);
        }
        public virtual int UpdateOfficeBranchSales(clsofficeBanchSales obj)
        {
            int result = 0;

            try
            {
                result = (int)db.SP_office_branch_sales_Update(obj.BranchSalesID, obj.InstanceID, obj.UserID, obj.OfficeBranchID, obj.Amount, obj.BillDate, obj.CreatedDate);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }

            return(result);
        }
        public virtual long InsertOfficeBranchSales(clsofficeBanchSales obj)
        {
            long result   = 0;
            long?resultID = 0;

            try
            {
                result = (long)db.SP_office_branch_sales_Insert(ref resultID, obj.InstanceID, obj.UserID, obj.OfficeBranchID, obj.Amount, obj.BillDate, obj.CreatedDate);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }

            return(result);
        }
        public ActionResult InsertOfficeBranchSales(string OfficeBranchSalesModel)
        {
            clsofficeBanchSales mOfficeBranch = new clsofficeBanchSales();
            var jsonExpenseMasterModel        = JObject.Parse(Convert.ToString(OfficeBranchSalesModel));

            mOfficeBranch             = new JavaScriptSerializer().Deserialize <clsofficeBanchSales>(OfficeBranchSalesModel);
            mOfficeBranch.InstanceID  = 1;
            mOfficeBranch.UserID      = 1;
            mOfficeBranch.CreatedDate = DateTime.Now;
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://*****:*****@2610");
            client.DefaultRequestHeaders.Add("X-Version", "1.1");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
            var responseMessage = client.PostAsJsonAsync("InsertOfficeBranchSales", mOfficeBranch).Result;

            return(Json(""));
        }
        public ActionResult GetOfficeBranchSalesDetail()
        {
            clsofficeBanchSales obj    = new clsofficeBanchSales();
            HttpClient          client = new HttpClient();

            client.BaseAddress = new Uri("http://*****:*****@2610");
            client.DefaultRequestHeaders.Add("X-Version", "1.1");
            client.DefaultRequestHeaders.Accept.Clear();
            client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

            var responseMessage = client.PostAsJsonAsync("GetOfficeBranchSalesDetail", obj).Result;

            if (responseMessage.IsSuccessStatusCode)
            {
                var responseData = responseMessage.Content.ReadAsStringAsync().Result;
                var jsonresult   = JsonConvert.DeserializeObject(responseData);
                return(Json(jsonresult, JsonRequestBehavior.AllowGet));
            }
            return(Json(""));
        }
        public virtual List <SP_office_branch_sales_SelectOneResult> GetOfficeBranchSalesDetailById(clsofficeBanchSales obj)
        {
            ISingleResult <SP_office_branch_sales_SelectOneResult> objResult;
            List <SP_office_branch_sales_SelectOneResult>          objResultList;

            try
            {
                objResult     = db.SP_office_branch_sales_SelectOne(obj.BranchSalesID);
                objResultList = new List <SP_office_branch_sales_SelectOneResult>(objResult);
            }
            catch (Exception ex)
            {
                LoggerFactory.LoggerInstance.LogException(ex);
                throw ex;
            }
            return(objResultList);
        }