//UPDATE COMMON DETAILS private void UpdateNewCommonDetails() { try { if (String.IsNullOrWhiteSpace(txtCommonNameOfDistrict.Text) || String.IsNullOrWhiteSpace(txtCommonNameOfSnrss.Text)) { MessageBox.Show("Common details can not be empty!", "Common Details", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSetting = new SettingClassBLL(); objSetting = new SettingClassBLL() { common_district = txtCommonNameOfDistrict.Text, common_snrss = txtCommonNameOfSnrss.Text, common_division = _division, common_username = _username }; objSetting.UpdateCommonDetailsDB(); MessageBox.Show("Common Details update successful!", "Common Details", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Common Details", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//ADD NEW LAND MARK DATA private void AddLandMark() { if (String.IsNullOrWhiteSpace(txtLMType.Text)) { MessageBox.Show("Please enter Land Mark Type!", "Land Mark Type", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSetting = new SettingClassBLL(); if (objSetting.CheckLandMarkType(txtLMType.Text) == false) { objSetting = new SettingClassBLL() { landMarkType = txtLMType.Text }; objSetting.AddNewLandMarkType(); MessageBox.Show("Land Mark Type added successful!", "Add New Land Mark Type", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadLandMarTypekData(); DeafultValueAddToStockDivision();//STOCK DEFAULT DATA ADD WITH LM TYPE ClearTextBoxces(); } else { MessageBox.Show("Land Mark Type is exist!", "Land Mark Type", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearTextBoxces(); } } }
//ADD NEW SURVEYOR TYPE private void AddSurveyorType() { try { if (String.IsNullOrWhiteSpace(txtSurveyorType.Text)) { MessageBox.Show("Please enter Surveyor Type!", "Add New Surveyor Type", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSetting = new SettingClassBLL(); if (objSetting.CheckSurveyorType(txtSurveyorType.Text) == false) { objSetting = new SettingClassBLL() { surveyorType = txtSurveyorType.Text }; objSetting.AddNewSuerveyorType(); MessageBox.Show("Surveyor New Type added successful!", "Add New Surveyor Type", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadSurveyorTypeData(); ClearTextBoxces(); } else { MessageBox.Show("Surveyor Type is exist!", "Add New Surveyor Type", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearTextBoxces(); } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Division Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//--------------------------------------------------------------// // LAND MARK TYPE // //--------------------------------------------------------------// //LOAD LAND MARK DATA private void LoadLandMarTypekData() { objSetting = new SettingClassBLL(); dgvLandMarkType.DataSource = objSetting.LoadLandMarkType(); dgvLandMarkType.DataMember = "Table_LM_Type"; DgvLandMarkTypeStyle(); }
//LOAD SURVEYOR TYPES private void LoadSurveyorTypeData() { objSetting = new SettingClassBLL(); dgvSurveyorType.DataSource = objSetting.LoadSurveyorType(); dgvSurveyorType.DataMember = "Table_Surveyor_Type"; DgvSurveyorTypeStyle(); }
//LOAD DIVISION DATA private void LoadDivisionDatas() { objSetting = new SettingClassBLL(); dgvDivision.DataSource = objSetting.LoadDivision(); dgvDivision.DataMember = "Table_Division"; DgvDivisionStyle(); }
//LOAD COMMON DETAILS private void LoadCommonDetails() { try { objSetting = new SettingClassBLL(); DataSet ds = new DataSet(); ds = (DataSet)objSetting.LoadCommonDetails(); _username = ds.Tables["Table_Common_Details"].Rows[0]["username"].ToString(); _division = ds.Tables["Table_Common_Details"].Rows[0]["division"].ToString(); txtCommonNameOfDistrict.Text = ds.Tables["Table_Common_Details"].Rows[0]["district"].ToString(); txtCommonNameOfSnrss.Text = ds.Tables["Table_Common_Details"].Rows[0]["snrss"].ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message, "Division Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//--------------------------------------------------------------// // DIVISION // //--------------------------------------------------------------// //ADD NEW DIVISION private void AddDivision() { try { if (String.IsNullOrWhiteSpace(txtDivisioin.Text) || String.IsNullOrWhiteSpace(txtDeportId.Text)) { MessageBox.Show("Please enter division name and deport id!", "Division Add", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSetting = new SettingClassBLL(); if (objSetting.DivivisionExist(txtDivisioin.Text) == false) { objSetting = new SettingClassBLL() { division = txtDivisioin.Text, deportId = txtDeportId.Text }; //ADD DIVISION objSetting.AddNewDivision(); MessageBox.Show("Added Successfully!", "Division Add", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadDivisionDatas(); DeafultValueAddToStock(); //STOCK DEFAULT DATA INSERTING ClearTextBoxces(); //CLEAR ALL TEXBOX AND COMBOBOX } else { MessageBox.Show("Division exist!", "Division Add", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearTextBoxces();//CLEAR ALL TEXBOX AND COMBOBOX } } btnAddDivision.Text = "Add"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Division Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//DIVISION WITH STOCK DEFAULT DATA private void DeafultValueAddToStockDivision() { try { objSetting = new SettingClassBLL(); foreach (var list in objSetting.AllDivisios()) { objSetting = new SettingClassBLL() { stock_lm_type = txtLMType.Text, stock_division = list.ToString(), stock_lm_total = 0 }; objSetting.DefaultStockData(); } MessageBox.Show("Stock default data inserted for new Land Mark Type!", "STOCK", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception ex) { MessageBox.Show(ex.Message, "STOCK", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//DIVISION DATA UPDATE private void UpdateDivision() { try { if (String.IsNullOrWhiteSpace(txtDivisioin.Text) || String.IsNullOrWhiteSpace(txtDeportId.Text)) { MessageBox.Show("Please enter division name!", "Division Update", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSetting = new SettingClassBLL(); if (objSetting.DivivisionExist(txtDivisioin.Text) == false) { //UPDATE DIVISION objSetting = new SettingClassBLL() { division = txtDivisioin.Text, oldDivision = dgvDivision.CurrentRow.Cells[0].Value.ToString(), deportId = txtDeportId.Text }; objSetting.UpdateDivision(); MessageBox.Show("Division Update successfully!", "Division Update", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadDivisionDatas(); ClearTextBoxces();//CLEAR ALL TEXBOX AND COMBOBOX } else { MessageBox.Show("Division exist!", "Division Add", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearTextBoxces();//CLEAR ALL TEXBOX AND COMBOBOX } ClearTextBoxces(); btnAddDivision.Text = "Add"; } } catch (Exception ex) { MessageBox.Show(ex.Message, "Division Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
//UPDATE LANDA MARK DATA private void UpdateLandMark() { try { if (String.IsNullOrWhiteSpace(txtLMType.Text)) { MessageBox.Show("Please enter Land Mark Type!", "Land Mark Type Update", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { objSetting = new SettingClassBLL(); if (objSetting.CheckLandMarkType(txtLMType.Text) == false) { objSetting = new SettingClassBLL() { landMarkType = txtLMType.Text, existLandMarkType = dgvLandMarkType.CurrentRow.Cells[0].Value.ToString() }; objSetting.UpdateLandMarkType(); MessageBox.Show("Land Mark Type update successful!", "Land Mark Type Update", MessageBoxButtons.OK, MessageBoxIcon.Information); LoadLandMarTypekData(); ClearTextBoxces(); } else { MessageBox.Show("Surveyor Type exist!", "Surveyor Type Update", MessageBoxButtons.OK, MessageBoxIcon.Error); ClearTextBoxces(); } } btnLMTypeAdd.Text = "Add"; } catch (Exception ex) { MessageBox.Show(ex.Message, "Division Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }