private void FillData() { LeadBO oleedBO = new LeadBO(); if (TableName == "Religion") { dt_Religion = LeadDL.GetReligion(); DGVTrans.DataSource = dt_Religion; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; oPickListBL.DtGetData.GetChanges(); } if (TableName == "Acheivement") { oPickListBL.GetAcheivement(BsfGlobal.OpenCRMDB()); dt = oPickListBL.DtGetData; DGVTrans.DataSource = oPickListBL.DtGetData; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Description"].Width = 280; } if (TableName == "Country") { dt_Country = LeadDL.GetCountry(); DGVTrans.DataSource = dt_Country; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Employment") { dt_Employ = LeadDL.GetEmpStatus(); DGVTrans.DataSource = dt_Employ; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "ApartmentType") { dt_ApaType = LeadDL.GetApartmentType(); DGVTrans.DataSource = dt_ApaType; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Apartment") { dt_Apat = LeadDL.GetApartment(); DGVTrans.DataSource = dt_Apat; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Stay") { dt_Stay = LeadDL.GetStay(); DGVTrans.DataSource = dt_Stay; DGVTrans.ForceInitialize(); dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "GuestHouse") { dt_GHouse = LeadDL.GetGuestHouse(); DGVTrans.DataSource = dt_GHouse; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "PossessMaster") { dt_PossMas = LeadDL.GetPossessMaster(); DGVTrans.DataSource = dt_PossMas; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Sel"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Possess") { oleedBO.i_LeadId = i_mId; dt_Pose = LeadDL.ShowPossess(oleedBO); DGVTrans.DataSource = dt_Pose; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Sel"].Visible = false; dgvTransView.Columns["LeadId"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "FacilityMaster") { dt_FaciliMas = LeadDL.GetFacilityMaster(); DGVTrans.DataSource = dt_FaciliMas; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Sel"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Facility") { oleedBO.i_LeadId = i_mId; dt_Facili = LeadDL.ShowFacility(oleedBO); DGVTrans.DataSource = dt_Facili; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Sel"].Visible = false; dgvTransView.Columns["LeadId"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "LeadAreaMaster") { dt_AreaMas = LeadDL.GetAreaMaster(); DGVTrans.DataSource = dt_AreaMas; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Sel"].Visible = false; dgvTransView.Columns["LeadId"].Visible = false; dgvTransView.Columns["Name"].Width = 280; //oleedBO.i_LeadId = i_mId; //dt_Ares = LeadDL.ShowArea(oleedBO); //DGVTrans.DataSource = dt_Ares; //dgvTransView.Columns["Id"].Visible = false; //dgvTransView.Columns["Sel"].Visible = false; //dgvTransView.Columns["LeadId"].Visible = false; //dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Area") { oleedBO.i_LeadId = i_mId; dt_Ares = LeadDL.ShowArea(oleedBO); DGVTrans.DataSource = dt_Ares; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Sel"].Visible = false; dgvTransView.Columns["LeadId"].Visible = false; dgvTransView.Columns["Name"].Width = 280; } if (TableName == "Cost_Centre") { oPickListBL.GetCostCentre(); dtData = oPickListBL.DtGetData; DGVTrans.DataSource = oPickListBL.DtGetData; dgvTransView.Columns["Id"].Visible = false; dgvTransView.Columns["Description"].Width = 250; dgvTransView.Columns["Sel"].Width = 60; dgvTransView.OptionsView.NewItemRowPosition = DevExpress.XtraGrid.Views.Grid.NewItemRowPosition.None; dgvTransView.Columns["Description"].OptionsColumn.ReadOnly = true; oPickListBL.DtGetData.AcceptChanges(); dtData.AcceptChanges(); } }
public static DataTable GetFacilityMaster() { return(LeadDL.GetFacilityMaster()); }
private void InsertData() { LeadBO OLEEDBO = new LeadBO(); string sql = ""; string s_Description = Convert.ToString(dgvTransView.GetRowCellValue(dgvTransView.FocusedRowHandle, "Name")); if (s_PMode == "A") { //int P_AreaId = 0; if (dt_AreaMas.Rows.Count >= 0 && dt_AreaMas.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO AreaMaster (Description) VALUES('{0}')", s_Description); //sql = String.Format("INSERT INTO Area (Description, LeadId, AreaId) VALUES('{0}', {1}, {2})", s_Description, i_mId, P_AreaId); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } } else { if (s_PMode == "A E") { int P_AreId = 0; dt_AreaMas = LeadDL.GetAreaMaster(); if (dt_AreaMas.Rows.Count >= 0 && dt_AreaMas.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO LeadAreaMaster (Description) VALUES('{0}')SELECT SCOPE_IDENTITY();", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); P_AreId = int.Parse(cmd.ExecuteScalar().ToString()); cmd.Dispose(); } } if (dt_Ares.Rows.Count >= 0 && dt_Ares.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO Area (Description, LeadId, AreaId) VALUES('{0}', {1}, {2})", s_Description, i_mId, P_AreId); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } } } if (s_PMode == "A") { if (dt_FaciliMas.Rows.Count >= 0 && dt_FaciliMas.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO FacilityMaster (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } } else { if (s_PMode == "F E") { int P_FacId = 0; dt_FaciliMas = LeadDL.GetFacilityMaster(); if (dt_FaciliMas.Rows.Count >= 0 && dt_FaciliMas.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO FacilityMaster (Description) VALUES('{0}')SELECT SCOPE_IDENTITY();", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); P_FacId = int.Parse(cmd.ExecuteScalar().ToString()); cmd.Dispose(); } } if (dt_Facili.Rows.Count >= 0 && dt_Facili.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO Facility (Description, LeadId, FacilityId) VALUES('{0}', {1}, {2})", s_Description, i_mId, P_FacId); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } } } if (s_PMode == "A") { if (dt_PossMas.Rows.Count >= 0 && dt_PossMas.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO PossessMaster (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } } else { if (s_PMode == "P E") { int P_PossId = 0; dt_PossMas = LeadDL.GetPossessMaster(); if (dt_PossMas.Rows.Count >= 0 && dt_PossMas.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO PossessMaster (Description) VALUES('{0}')SELECT SCOPE_IDENTITY();", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); P_PossId = int.Parse(cmd.ExecuteScalar().ToString()); } } if (dt_Pose.Rows.Count >= 0 && dt_Pose.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO Possess (Description, LeadId, PossessId) VALUES('{0}', {1}, {2})", s_Description, i_mId, P_PossId); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } } } if (dt_Stay.Rows.Count >= 0 && dt_Stay.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO Stay (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } if (dt_GHouse.Rows.Count >= 0 && dt_GHouse.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO GuestHouse (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } if (dt_Employ.Rows.Count >= 0 && dt_Employ.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO Employment (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } if (dt_ApaType.Rows.Count >= 0 && dt_ApaType.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO ApartmentType (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } if (dt_Apat.Rows.Count >= 0 && dt_Apat.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO Apartment (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } if (dt_Country.Rows.Count >= 0 && dt_Country.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO CountryMaster (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } if (dt_Religion.Rows.Count >= 0 && dt_Religion.Columns.Count > 0) { if (s_Description != "") { sql = String.Format("INSERT INTO ReligionMaster (Description) VALUES('{0}')", s_Description); SqlCommand cmd = new SqlCommand(sql, BsfGlobal.OpenCRMDB()); cmd.ExecuteNonQuery(); cmd.Dispose(); } } }