public void capNhatTrangThaiKhachHang(string ip_id_trang_thai, Guid ip_id_khach_hang_sd_sp, string ip_str_so_tien, string ip_str_ghi_chu, string ip_str_dang_cham_soc) { try { BKI_CRMEntities v_model = new BKI_CRMEntities(); GD_CHUYEN_TRANG_THAI v_gd_chuyen_trang_thai = new GD_CHUYEN_TRANG_THAI(); v_gd_chuyen_trang_thai.ID = Guid.NewGuid(); v_gd_chuyen_trang_thai.TRANG_THAI_HIEN_TAI_YN = true; v_gd_chuyen_trang_thai.ID_TRANG_THAI = new Guid(ip_id_trang_thai); v_gd_chuyen_trang_thai.ID_KHACH_HANG = ip_id_khach_hang_sd_sp; v_gd_chuyen_trang_thai.ID_NGUOI_CHUYEN_TRANG_THAI = new Guid("31a0d5da-6d48-482b-ac68-1273ba8c5bf6"); v_gd_chuyen_trang_thai.SO_TIEN_DA_NHAN = decimal.Parse(ip_str_so_tien); v_gd_chuyen_trang_thai.GHI_CHU = ip_str_ghi_chu; v_gd_chuyen_trang_thai.NGAY_CHUYEN_TRANG_THAI = DateTime.Now.Date; v_gd_chuyen_trang_thai.DANG_CHAM_SOC_YN = bool.Parse(ip_str_dang_cham_soc); v_gd_chuyen_trang_thai.KIEM_TRA_YEU_CAU_CHUYEN_TRANG_THAI = "000000"; v_model.GD_CHUYEN_TRANG_THAI.Add(v_gd_chuyen_trang_thai); v_model.SaveChanges(); } catch (System.Exception v_e) { v_e.Log(); } }
public ActionResult CapNhatTrangThai(string ip_id_chuyen_trang_thai_hien_tai, string ip_str_id_khach_hang, string ip_str_id_trang_thai, string ip_str_ip_nguoi_chuyen_tt, string ip_dc_so_tien, string ip_str_ghi_chu, string ip_str_kiem_tra_yeu_cau) { try { if (ip_str_kiem_tra_yeu_cau.Trim().Contains("0")) { BKI_CRMEntities v_model = new BKI_CRMEntities(); var v_model_gd_chuyen_tt = v_model.GD_CHUYEN_TRANG_THAI.Where(x => x.ID == new Guid(ip_id_chuyen_trang_thai_hien_tai)).First(); if (ip_str_kiem_tra_yeu_cau.Trim() == v_model_gd_chuyen_tt.KIEM_TRA_YEU_CAU_CHUYEN_TRANG_THAI.Trim()) { return(Json(true, JsonRequestBehavior.AllowGet)); } else { v_model_gd_chuyen_tt.KIEM_TRA_YEU_CAU_CHUYEN_TRANG_THAI = ip_str_kiem_tra_yeu_cau; v_model_gd_chuyen_tt.SO_TIEN_DA_NHAN = decimal.Parse(ip_dc_so_tien); v_model.SaveChanges(); return(Json(true, JsonRequestBehavior.AllowGet)); } } else { BKI_CRMEntities v_model = new BKI_CRMEntities(); var v_model_gd_chuyen_tt = v_model.GD_CHUYEN_TRANG_THAI.Where(x => x.ID == new Guid(ip_id_chuyen_trang_thai_hien_tai)).First(); v_model_gd_chuyen_tt.TRANG_THAI_HIEN_TAI_YN = false; v_model_gd_chuyen_tt.KIEM_TRA_YEU_CAU_CHUYEN_TRANG_THAI = ip_str_kiem_tra_yeu_cau.Trim(); v_model.SaveChanges(); GD_CHUYEN_TRANG_THAI v_gd_chuyen_tt = new GD_CHUYEN_TRANG_THAI(); //-------------------------------------------------------------------- v_gd_chuyen_tt.ID_KHACH_HANG = v_model_gd_chuyen_tt.ID_KHACH_HANG; v_gd_chuyen_tt.NGAY_CHUYEN_TRANG_THAI = DateTime.Now; v_gd_chuyen_tt.DANG_CHAM_SOC_YN = true; v_gd_chuyen_tt.TRANG_THAI_HIEN_TAI_YN = true; //-------------------------------------------------------------------- v_gd_chuyen_tt.ID = Guid.NewGuid(); v_gd_chuyen_tt.TRANG_THAI_HIEN_TAI_YN = true; v_gd_chuyen_tt.SO_TIEN_DA_NHAN = decimal.Parse(ip_dc_so_tien); v_gd_chuyen_tt.ID_TRANG_THAI = new Guid(ip_str_id_trang_thai); v_gd_chuyen_tt.ID_NGUOI_CHUYEN_TRANG_THAI = new Guid(ip_str_ip_nguoi_chuyen_tt); v_gd_chuyen_tt.KIEM_TRA_YEU_CAU_CHUYEN_TRANG_THAI = "000"; v_model.GD_CHUYEN_TRANG_THAI.Add(v_gd_chuyen_tt); v_model.SaveChanges(); } return(Json(true, JsonRequestBehavior.AllowGet)); } catch (System.Exception v_e) { v_e.Log(); return(Json(false)); } }