/// <summary> /// 新增 /// </summary> /// <param name="model">实体</param> /// <returns></returns> public bool AddNew(Models.ys_Company model) { string sqlText = @"INSERT INTO [AssetsSys].[dbo].[ys_Company] ([Id] ,[CompanyName] ,[Contact] ,[Tell] ,[Address] ,[Description] ,[CreateTime] ,[IsRemoved]) VALUES (@Id ,@CompanyName ,@Contact ,@Tell ,@Address ,@Description ,@CreateTime ,@IsRemoved)"; SqlParameter s1 = new SqlParameter("@Id", model.Id); SqlParameter s2 = new SqlParameter("@CompanyName", model.CompanyName); SqlParameter s3 = new SqlParameter("@Contact", model.Contact); SqlParameter s4 = new SqlParameter("@Tell", model.Tell); SqlParameter s5 = new SqlParameter("@Address", model.Address); SqlParameter s6 = new SqlParameter("@Description", model.Description); SqlParameter s7 = new SqlParameter("@CreateTime", model.CreateTime); SqlParameter s8 = new SqlParameter("@IsRemoved", model.IsRemoved); SqlParameter[] cmdPara = new SqlParameter[] { s1, s2, s3, s4, s5, s6, s7, s8 }; return(Models.SqlHelper.ExecuteNoQuery(sqlText, cmdPara) > 0 ? true : false); }
private void gvData_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { if (gvData.FocusedRowHandle >= 0) { Guid Id = (Guid)gvData.GetFocusedRowCellValue("Id"); model = dbList.FirstOrDefault(m => m.Id == Id); txtID.EditValue = model.Id; txtAddress.Text = model.Address; txtFullName.Text = model.CompanyName; txtPersonName.Text = model.Contact; txtRemark.Text = model.Description; txtTell.Text = model.Tell; } }
/// <summary> /// 修改 /// </summary> /// <param name="model">实体</param> /// <returns></returns> public bool Modify(Models.ys_Company model) { string sqlText = @" UPDATE[AssetsSys].[dbo].[ys_Company] SET[CompanyName] = @CompanyName ,[Contact] = @Contact ,[Tell] = @Tell ,[Address] = @Address ,[Description] = @Description ,[CreateTime] = @CreateTime ,[IsRemoved] = @IsRemoved WHERE[Id] = @Id"; SqlParameter s1 = new SqlParameter("@Id", model.Id); SqlParameter s2 = new SqlParameter("@CompanyName", model.CompanyName); SqlParameter s3 = new SqlParameter("@Contact", model.Contact); SqlParameter s4 = new SqlParameter("@Tell", model.Tell); SqlParameter s5 = new SqlParameter("@Address", model.Address); SqlParameter s6 = new SqlParameter("@Description", model.Description); SqlParameter s7 = new SqlParameter("@CreateTime", model.CreateTime); SqlParameter s8 = new SqlParameter("@IsRemoved", model.IsRemoved); SqlParameter[] cmdPara = new SqlParameter[] { s1, s2, s3, s4, s5, s6, s7, s8 }; return(Models.SqlHelper.ExecuteNoQuery(sqlText, cmdPara) > 0 ? true : false); }
/// <summary> /// 修改 /// </summary> /// <param name="model">实体</param> /// <returns></returns> public bool Modify(Models.ys_Company model) { return(dal.Modify(model)); }
/// <summary> /// 新增 /// </summary> /// <param name="model">实体</param> /// <returns></returns> public bool AddNew(Models.ys_Company model) { return(dal.AddNew(model)); }