public void getEmployeeTreeCopy() { int keyValueTree = 0; string keySelectTree = ""; var listSelectedNodes = ASPxTreeList2.GetSelectedNodes(); Structure oneStructure; Employee_Structure oneEmpStru; foreach (var oneSelectNode in listSelectedNodes) { oneStructure = new Structure(); oneEmpStru = new Employee_Structure(); keyValueTree = int.Parse(oneSelectNode.Key); oneStructure = db.Structures.FirstOrDefault(x => x.Structure_Parent == keyValueTree && x.Is_Job_Title == true && x.Is_Manager == true); if (oneStructure != null) { keyValueTree = oneStructure.Structure_Id; oneEmpStru = db.Employee_Structure.FirstOrDefault(x => x.Structure_Id == keyValueTree && x.Status_Structure == true); if (oneEmpStru != null) { if (currentStructureUserId != oneEmpStru.Employee_Structure_Id) { keySelectTree = oneEmpStru.Employee_Structure_Id.ToString(); treatmentCopyTo.Items.FindByValue(keySelectTree).Selected = true; } } } } }
protected void Page_Load(object sender, EventArgs e) { AccountingBO accountBO = new AccountingBO(); //accountBO.InitBalanceForward(session, AccountingPeriodBO.getCurrentAccountingPeriod(session)); var datasource1 = accountBO.getLedgerListByAccountCategory(session, "ASSET"); var datasource2 = accountBO.getLedgerListByAccountCategory(session, "LIABILITY"); var datasource3 = accountBO.getLedgerListByAccountCategory(session, "EQUITY"); ASPxTreeList1.DataSource = datasource1; ASPxTreeList2.DataSource = datasource2; ASPxTreeList3.DataSource = datasource3; ASPxTreeList1.DataBind(); ASPxTreeList2.DataBind(); ASPxTreeList3.DataBind(); XPQuery <AccountCategory> AccCateQuery = session.Query <AccountCategory>(); General gen = new General(); AccountCategory AccCate = AccCateQuery.Where(r => r.Code == "ASSET").FirstOrDefault(); totalAsset = gen.TotalBalance(session, AccCate); AccCate = AccCateQuery.Where(r => r.Code == "LIABILITY").FirstOrDefault(); totalLiability = gen.TotalBalance(session, AccCate); AccCate = AccCateQuery.Where(r => r.Code == "EQUITY").FirstOrDefault(); totalEquity = gen.TotalBalance(session, AccCate); ASPxTextBox tb1 = ASPxTreeList1.FindFooterTemplateControl(ASPxTreeList1.Columns[2], "AssetTotal") as ASPxTextBox; tb1.Value = ParseStringNumber(totalAsset.ToString()); tb1.Text = ParseStringNumber(totalAsset.ToString()); ASPxTextBox tb2 = ASPxTreeList2.FindFooterTemplateControl(ASPxTreeList2.Columns[2], "LiabilityTotal") as ASPxTextBox; tb2.Value = ParseStringNumber(totalLiability.ToString()); tb2.Text = ParseStringNumber(totalLiability.ToString()); ASPxTextBox tb3 = ASPxTreeList3.FindFooterTemplateControl(ASPxTreeList3.Columns[2], "EquityTotal") as ASPxTextBox; tb3.Value = ParseStringNumber(totalEquity.ToString()); tb3.Text = ParseStringNumber(totalEquity.ToString()); ASPxTextBox tb4 = ASPxTreeList3.FindFooterTemplateControl(ASPxTreeList3.Columns[2], "DebitTotal") as ASPxTextBox; tb4.Value = ParseStringNumber((totalLiability + totalEquity).ToString()); tb4.Text = ParseStringNumber((totalLiability + totalEquity).ToString()); }
private void fillAllStructure() { List <Employee_Structure> ListEmployeeStructure10 = new List <Employee_Structure>(); ListEmployeeStructure10 = loadSendEmployeeStructure(); if (SessionWrapper.LoggedUser.Language_id == 1) { var dc1 = from c in ListEmployeeStructure10 where c.Employee_Id != currentUserId select new { ddlKey = c.Employee_Structure_Id, employeeName = c.Employee.Employee_Name_Ar, jobTitle = c.Structure.Structure_Name_Ar }; ASPxGridView1.DataSource = dc1.ToList(); ASPxGridView1.DataBind(); ASPxGridView2.DataSource = dc1.ToList(); ASPxGridView2.DataBind(); } else { var dc1 = from c in ListEmployeeStructure10 where c.Employee_Id != currentUserId select new { ddlKey = c.Employee_Structure_Id, employeeName = c.Employee.Employee_Name_En, jobTitle = c.Structure.Structure_Name_En }; ASPxGridView1.DataSource = dc1.ToList(); ASPxGridView1.DataBind(); ASPxGridView2.DataSource = dc1.ToList(); ASPxGridView2.DataBind(); } //////////////////////////////////////////////////////////////////////////////////////////////// ListStructure = loadTreeStructure(); ASPxTreeList1.DataSource = ListStructure; ASPxTreeList1.KeyFieldName = "Structure_Id"; ASPxTreeList1.ParentFieldName = "Structure_Parent"; if (SessionWrapper.LoggedUser.Language_id == 1) { ASPxTreeList1.PreviewFieldName = "Structure_Name_Ar"; } else { ASPxTreeList1.PreviewFieldName = "Structure_Name_En"; } ASPxTreeList1.DataBind(); ASPxTreeList2.DataSource = ListStructure; ASPxTreeList2.KeyFieldName = "Structure_Id"; ASPxTreeList2.ParentFieldName = "Structure_Parent"; if (SessionWrapper.LoggedUser.Language_id == 1) { ASPxTreeList2.PreviewFieldName = "Structure_Name_Ar"; } else { ASPxTreeList2.PreviewFieldName = "Structure_Name_En"; } ASPxTreeList2.DataBind(); }