private void BtnMapToCompanyUnitOk_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(TxtCompanyUnit.Text)) { MessageBox.Show("Company Unit Description is Required..!!", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtCompanyUnit.Focus(); return; } ProductMappingList ObjProductMappingList = null; foreach (DataGridViewRow ro in GridCompanyUnit.Rows) { ObjProductMappingList = new ProductMappingList(); if (Convert.ToBoolean(ro.Cells[0].Value) == true) { ObjProductMappingList.ProductId = Convert.ToInt32(ro.Cells["ProductId"].Value.ToString()); ObjProductMappingList.CompanyUnitId = Convert.ToInt32(TxtCompanyUnit.Tag.ToString()); ObjProductMappingList.BranchId = Convert.ToInt32(LblBranch.Tag.ToString()); _objProduct.ModelProductMappingList.Add(ObjProductMappingList); } } _objProduct.SaveProductMapping("CompanyUnit"); MessageBox.Show("Your Data Has Been Updated Successfully !", "Mr Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); CompanyUnitListForProductMapping(); }
private void BtnSearchCompanyUnit_Click(object sender, EventArgs e) { Common.PickList frmPickList = new Common.PickList("CompanyUnit", _SearchKey); if (Common.PickList.dt.Rows.Count > 0) { frmPickList.ShowDialog(); if (frmPickList.SelectedList.Count > 0) { TxtCompanyUnit.Text = frmPickList.SelectedList[0]["CmpUnitName"].ToString().Trim(); TxtCompanyUnit.Tag = frmPickList.SelectedList[0]["CompanyUnitId"].ToString().Trim(); LblBranch.Text = frmPickList.SelectedList[0]["BranchName"].ToString().Trim(); LblBranch.Tag = frmPickList.SelectedList[0]["BranchId"].ToString().Trim(); CompanyUnitListForProductMapping(); } frmPickList.Dispose(); } else { MessageBox.Show("No List Available in Company Unit !", "Mr. Solution", MessageBoxButtons.OK, MessageBoxIcon.Information); TxtCompanyUnit.Focus(); return; } TxtCompanyUnit.Focus(); }