Exemple #1
0
        public JsonResult AddEditClient(dtoClient client)
        {
            dtoResult result;
            var currentUser = (dtoUserAccount)Session["CurrentUser"];

            if (client.clientId == 0)
            {
                client.branchId = currentUser.branchId;
                client.createdBy = currentUser.userId;
                client.dateCreated = DateTime.Now;
                result = service.Insert(client);
            }
            else
            {
                client.modifiedBy = currentUser.userId;
                client.dateLastModified = DateTime.Now;
                result = service.Update(client);
            }

            return Json(result);
        }
Exemple #2
0
        //not being used?
        public ActionResult GetAllClient(jQueryDataTableParamModel param)
        {
            int filterStatus = 0;
            //int totalRecords = 0;

            if (Request["status"] != null && Request["status"] != string.Empty)
                filterStatus = Convert.ToInt32(Request["status"]);

            var filter = new dtoClient
            {
                clientCode = Request["clientCode"],
                clientName = Request["clientName"],
                clientContactNumber = Request["clientContactNumber"],
                clientContactPerson = Request["clientContactPerson"],
                status = filterStatus
            };

            //var list = serviceClientAccount.GetAllSuppliers(filter, param.iDisplayStart, param.iDisplayLength);
            //totalRecords = serviceClientAccount.GetRecordCount(filter);

            //int count = list.Count();

            return Json(new
            {
                //sEcho = param.sEcho,
                //iTotalRecords = totalRecords,
                //iTotalDisplayRecords = totalRecords,
                //aaData = list
            }
            , JsonRequestBehavior.AllowGet);
        }
Exemple #3
0
 public JsonResult Save(dtoClient param)
 {
     serviceClientAccount.Save(param);
     return Json(new dtoResult());
 }
Exemple #4
0
        public JsonResult GetAllClients()
        {
            var currentUser = (dtoUserAccount)Session["CurrentUser"];
            var page = int.Parse(Request["page"]);
            var recordPerPage = int.Parse(Request["recordPerPage"]);
            var isExport = false;

            var filter = new dtoClient
            {
                clientCode=Request["clientCodeSearch"],
                clientName=Request["clientNameSearch"],
                clientContactNumber=Request["clientContactNumberSearch"],
                clientContactPerson=Request["clientContactPersonSearch"],
                branchId = currentUser.branchId
            };

               var list = service.GetAllClients(page, recordPerPage, filter,isExport);
               var ret = Json(list);
               return ret;
        }
        public dtoResult Update(dtoClient t)
        {
            var result = new dtoResult();
            result.isSuccessful = true;
            try
            {
                var entity = DBContext.tbl_client.FirstOrDefault(d => d.clientId == t.clientId);

                entity.clientCode = t.clientCode;
                entity.clientName = t.clientName;
                entity.clientAddress = t.clientAddress;
                entity.clientContactNumber = t.clientContactNumber;
                entity.clientContactPerson = t.clientContactPerson;
                entity.status = t.status;
                entity.modifiedBy = t.modifiedBy;
                entity.dateLastModified = t.dateLastModified;

                DBContext.SaveChanges();

            }
            catch (Exception ex)
            {
                result.isSuccessful = false;
                result.errorMsg = ex.ToString();

            }

            return result;
        }
 public dtoClient Get(dtoClient t)
 {
     throw new NotImplementedException();
 }
 public dtoResult SoftDelete(dtoClient t)
 {
     throw new NotImplementedException();
 }
        public dtoResult Insert(dtoClient t)
        {
            var result = new dtoResult();
            result.isSuccessful = true;
            try
            {

                var entiry = new tbl_client {
                    clientCode = t.clientCode,
                    clientName = t.clientName,
                    clientAddress = t.clientAddress,
                    clientContactNumber = t.clientContactNumber,
                    clientContactPerson = t.clientContactPerson,
                    createdBy = t.createdBy,
                    dateCreated = t.dateCreated,
                    status = t.status,
                    branchId = t.branchId
                };

                DBContext.tbl_client.Add(entiry);
                DBContext.SaveChanges();

                t.clientId = entiry.clientId;
                result.returnObj = t;
            }
            catch (Exception ex)
            {
                result.isSuccessful = false;
                result.errorMsg = ex.ToString();

            }

            return result;
        }