/// <summary>
        /// Cập nhật thông tin khách hàng
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public ActionResult Update(CustomeDetail obj)
        {
            int result = 0;

            //int result = _priceLevelService.updateCustome(obj);
            return(Json(new { result = result }, JsonRequestBehavior.AllowGet));
        }
        public int updateCustome(CustomeDetail obj)
        {
            using (var db = _connectionData.OpenDbConnection())
            {
                using (var tran = db.OpenTransaction())
                {
                    DateTime DOB;

                    DateTime.TryParse(obj.DOB, CultureInfo.GetCultureInfo("vi-vn"), DateTimeStyles.None, out DOB);
                    try
                    {
                        var model = db.Single <tbl_Customer>(x => x.Id == obj.Id);
                        model.Name           = obj.Name;
                        model.CountryId      = obj.CountryId;
                        model.DOB            = DOB;
                        model.Address        = obj.Address;
                        model.Sex            = obj.Sex;
                        model.TeamSTT        = obj.TeamSTT;
                        model.TeamMergeSTT   = obj.TeamMergeSTT;
                        model.Email          = obj.Email;
                        model.IdentifyNumber = obj.IdentifyNumber;
                        model.Phone          = obj.Phone;
                        model.Mobile         = obj.Mobile;

                        model.Company = obj.Company;
                        //var g = db.Single<tbl_CustomerGroup>(x => x.Customer_ID == obj.Id);
                        //g.Doan_ID = obj.TeamSTT;
                        //g.Gop_Doan_ID = obj.TeamMergeSTT;
                        db.Update(model);
                        //db.Update(g);
                        tran.Commit();
                        return(1);
                    }
                    catch (Exception)
                    {
                        tran.Rollback();
                        return(0);
                    }
                }
            }
        }
Exemple #3
0
        public PartialViewResult GetDetail(int id)
        {
            var obj   = _customerManage.GetCustomer(id);
            var model = new CustomeDetail();

            model.Id             = obj.Id;
            model.Name           = obj.Name;
            model.CountryId      = obj.CountryId;
            model.DOB            = obj.DOB.GetValueOrDefault().ToString("dd/MM/yyyy");
            model.Address        = obj.Address;
            model.Sex            = obj.Sex;
            model.TeamSTT        = obj.TeamSTT;
            model.TeamMergeSTT   = obj.TeamMergeSTT;
            model.Email          = obj.Email;
            model.IdentifyNumber = obj.IdentifyNumber;
            model.Phone          = obj.Phone;
            model.Mobile         = obj.Mobile;
            model.Company        = obj.Company;
            model.Payer          = true;
            model.Leader         = true;
            model.ListCountry    = _customerManage.getAllCountry();
            return(PartialView("DetailCustomer", model));
        }
Exemple #4
0
        /// <summary>
        /// Cập nhật thông tin khách hàng
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public ActionResult Update(CustomeDetail obj)
        {
            int result = _customerManage.updateCustome(obj);

            return(Json(new { result = result }, JsonRequestBehavior.AllowGet));
        }