/// <summary> /// This method will return an object representing the record matching the primary key information specified. /// </summary> /// /// <param name="pk" type="ADGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADGroup</returns> public ADGroup SelectOne(ADGroupPrimaryKey pk) { _aDGroupWCF = new ADGroup(); _aDGroup = POS.DataLayer.ADGroupBase.SelectOne(new POS.DataLayer.ADGroupPrimaryKey(pk.GroupID)); _aDGroupWCF.GroupID = _aDGroup.GroupID; _aDGroupWCF.GroupName = _aDGroup.GroupName; return _aDGroupWCF; }
public override void btn_Delete_Click(object sender, EventArgs e) { if (dgrid_Result.SelectedRows.Count != 0) { ADGroupPrimaryKey pk = new ADGroupPrimaryKey(); pk.GroupID = Convert.ToInt32(dgrid_Result.SelectedRows[0].Cells["GroupID"].Value); if (_aDGroupWrapper.Delete(pk)) { MessageBox.Show("تم الحذف"); BindGrid(); } } else { MessageBox.Show("اختر عنصر اولا"); } }
/// <summary> /// Private methods /// </summary> /// <param name="groupID"></param> /// //private void FillRolesDataGrid() //{ // dgrid_Roles.DataSource = null; // dgrid_Roles.AutoGenerateColumns = false; // dgrid_Roles.DataSource = _aDRoleWrapper.SelectAll(); // dgrid_Roles.Columns[0].DataPropertyName = "RoleID"; // dgrid_Roles.Columns[2].DataPropertyName = "RoleName"; // for (int i = 0; i < dgrid_Roles.Rows.Count; i++) // { // //DataGridViewCheckBoxCell chk = (DataGridViewCheckBoxCell)dgrid_Roles.Rows[i].Cells["check"]; // //chk.Selected = false; // } //} private void InitiateEntity(int groupID) { ADGroupPrimaryKey pk = new ADGroupPrimaryKey(); pk.GroupID = groupID; ADGroup _aDGroup = _aDGroupWrapper.SelectOne(pk); tbx_GroupName.Text = _aDGroup.GroupName; //ADGroupRoleCollection _aDGroupRoleCollection = _aDGroupRoleWrapper.SelectByGroupID(groupID); //foreach (ADGroupRole _aDGroupRole in _aDGroupRoleCollection) //{ // foreach (DataGridViewRow row in dgrid_Roles.Rows) // { // if (Convert.ToInt32(row.Cells["RoleID"].Value) == _aDGroupRole.RoleID) // { // row.Cells["check"].Value = true; // //chk.Selected = true; // //chk.TrueValue = true; // //chk.Value = 1; // } // } //} }
///<summary> ///This method will Delete the object from the database ///</summary> ///<param name="pk" type="ADGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <returns>True if succeeded</returns> public bool Delete(ADGroupPrimaryKey pk) { return POS.DataLayer.ADGroupBase.Delete(new POS.DataLayer.ADGroupPrimaryKey(pk.GroupID)); }