Example #1
0
        public ActionResult SaveCallLog(DC_CS_CallHistory item)
        {
            if (asset.View)
            {
                using (var dbConn = Helpers.OrmliteConnection.openConn())
                {
                    try
                    {
                        item.RowCreatedUser = currentUser.UserName;
                        item.RowCreatedTime = DateTime.Now;
                        item.Note           = item.NoteCallLog;
                        if (!string.IsNullOrEmpty(item.OrderID))
                        {
                            var check = dbConn.Select <IXOrderFulfillmentTable>("select top 1 * from IXOrderFulfillmentTable where OrderID = {0} AND MobilePhone = {1}", item.OrderID, item.MobilePhone);
                            if (check.Count == 0)
                            {
                                return(Json(new { success = false, message = "Đơn hàng không tồn tại" }));
                            }
                        }
                        else
                        {
                            item.OrderID = string.IsNullOrEmpty(item.OrderID) ? "" : item.OrderID;
                        }


                        dbConn.Insert(item);
                        return(Json(new { success = true }));
                    }
                    catch (Exception e)
                    {
                        return(Json(new { success = false, message = e.Message }));
                    }
                }
            }
            else
            {
                return(Json(new { success = false, message = "You don't have permission to create record " }));
            }
        }
Example #2
0
        public ActionResult CallLog_Read([DataSourceRequest] DataSourceRequest request, string CustomerID)
        {
            var data = DC_CS_CallHistory.GetByCustomerID(CustomerID);

            return(Json(data.ToDataSourceResult(request)));
        }