public static string ThemKichThuoc(string id, string tenKichThuoc, string maKichThuoc, string heSoChatDai, string kichHoat, string ghiChu) { Guid currentUserID = Guid.NewGuid(); string currentUser = ""; #region Get current User MembershipUser membershipUser = Membership.GetUser(HttpContext.Current.User.Identity.Name); if (membershipUser != null) { currentUser = membershipUser.UserName; currentUserID = (Guid)membershipUser.ProviderUserKey; } #endregion get current User xRPDataContext dataContext = new xRPDataContext(); Qldh_DanhMucSong qlvt = new Qldh_DanhMucSong(); try { int? idd = int.Parse(id) == 0 || int.Parse(id) == -1 ? (int?)null : int.Parse(id); bool KichHoat = false; if (kichHoat == "1") { KichHoat = true; } if (kichHoat == "0") { KichHoat = false; } string result = ""; if (int.Parse(id) == -1) { result = dataContext.Sp_Qldh_LoaiKichThuoc_Add_Edit_Deli("ADD", int.Parse(id), tenKichThuoc, maKichThuoc, double.Parse(heSoChatDai), ghiChu, KichHoat, currentUserID, currentUserID, ref idd, Util.GetIP(), Util.GetPCName()).FirstOrDefault().Column1; } if (int.Parse(id) > 0) { result = dataContext.Sp_Qldh_LoaiKichThuoc_Add_Edit_Deli("EDIT", int.Parse(id), tenKichThuoc, maKichThuoc, double.Parse(heSoChatDai), ghiChu, KichHoat, currentUserID, currentUserID, ref idd, Util.GetIP(), Util.GetPCName()).FirstOrDefault().Column1; } if (!string.IsNullOrEmpty(result)) { return(result); } } catch (Exception ex) { return("ERROR: " + ex.Message + ex.StackTrace); } return("SUCCESS"); }