/// <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> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ADGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// <param name="pageSize" type="int">Number of records returned.</param> /// <param name="skipPages" type="int">The number of missing pages.</param> /// <param name="orderByStatement" type="string">The field value to number.</param> /// /// <returns>object of class ADUserCollection</returns> public ADUserCollection SelectAllByForeignKeyGroupIDPaged(ADGroupPrimaryKey pk, int pageSize, int skipPages, string orderByStatement) { ADUserCollection aDUserCollection = new ADUserCollection(); foreach (POS.DataLayer.ADUser _aDUser in POS.DataLayer.ADUserBase.SelectAllByForeignKeyGroupIDPaged(new POS.DataLayer.ADGroupPrimaryKey(pk.GroupID), pageSize, skipPages, orderByStatement)) { _aDUserWCF = new ADUser(); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; aDUserCollection.Add(_aDUserWCF); } return(aDUserCollection); }
/// <summary> /// This method will get row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ADGroupPrimaryKey">Primary Key information based on which data is to be fetched.</param> /// /// <returns>object of class ADUserCollection</returns> public ADUserCollection SelectAllByForeignKeyGroupID(ADGroupPrimaryKey pk) { ADUserCollection aDUserCollection = new ADUserCollection(); foreach (POS.DataLayer.ADUser _aDUser in POS.DataLayer.ADUserBase.SelectAllByForeignKeyGroupID(new POS.DataLayer.ADGroupPrimaryKey(pk.GroupID))) { _aDUserWCF = new ADUser(); _aDUserWCF.UserID = _aDUser.UserID; _aDUserWCF.UserFullName = _aDUser.UserFullName; _aDUserWCF.UserName = _aDUser.UserName; _aDUserWCF.Password = _aDUser.Password; _aDUserWCF.GroupID = _aDUser.GroupID; _aDUserWCF.Email = _aDUser.Email; _aDUserWCF.Address = _aDUser.Address; _aDUserWCF.Phone = _aDUser.Phone; _aDUserWCF.Mobile = _aDUser.Mobile; aDUserCollection.Add(_aDUserWCF); } return(aDUserCollection); }
/// <summary> /// This method will delete row(s) from the database using the value of the field specified /// along with the details of the child table. /// </summary> /// /// <param name="pk" type="ADGroupPrimaryKey">Primary Key information based on which data is to be deleted.</param> /// /// <returns>True if succeeded</returns> public bool DeleteAllByForeignKeyGroupID(ADGroupPrimaryKey pk) { return(POS.DataLayer.ADUserBase.DeleteAllByForeignKeyGroupID(new POS.DataLayer.ADGroupPrimaryKey(pk.GroupID))); }
///<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))); }
/// <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; // } // } //} }