private void prcDisplayDetails(string strParam) { string sqlQuery = "Exec prcGetGroup " + Int32.Parse(strParam); dsDetails = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "Group"; DataRow dr; if (dsDetails.Tables["Group"].Rows.Count > 0) { dr = dsDetails.Tables["Group"].Rows[0]; this.txtMenuId.Text = dr["mMenuGroupId"].ToString(); this.txtMenuName.Text = dr["mMenuGroupName"].ToString(); this.txtMenuCaption.Text = dr["mMenuGroupCaption"].ToString(); this.cboModule.Text = dr["ModuleId"].ToString(); this.btnDelete.Enabled = true; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec [WebprcGetMenu_Web] 0"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "MenuList"; dsList.Tables[1].TableName = "MenuAll"; dsList.Tables[2].TableName = "asdf"; dsList.Tables[3].TableName = "GroupList"; dsList.Tables[4].TableName = "FieldName"; dsList.Tables[5].TableName = "FieldOperator"; dvgrid = dsList.Tables["MenuList"].DefaultView; gridList.DataSource = null; gridList.DataSource = dvgrid; } finally { clsCon = null; } }
private void gridList_DoubleClick(object sender, EventArgs e) { prcClearData(); txtUserId.Text = gridList.ActiveRow.Cells[0].Value.ToString(); string sqlQuery = "Exec prcGetPermission_Module 0 , " + Int32.Parse(this.txtUserId.Text.ToString()) + ""; GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsCombo = new System.Data.DataSet(); try { clsCon.GTRFillDatasetWithSQLCommand(ref dsCombo, sqlQuery); dsDetails.Tables[0].TableName = "ModuleUser"; cboModule.DataSource = null; cboModule.DataSource = dsCombo; cboModule.DisplayMember = "moduleCaption"; cboModule.ValueMember = "moduleId"; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { clsCon = null; } }
//private void txtMenuCaption_MouseClick(object sender, MouseEventArgs e) //{ // clsProc.GTRGotFocus(ref txtMenuLink); //} //private void txtMenuCaption_Enter(object sender, EventArgs e) //{ // clsProc.GTRGotFocus(ref txtMenuLink); //} private void prcDisplayDetails(string strParam) { string sqlQuery = "Exec [WebprcGetMenu_Web] " + Int32.Parse(strParam); dsDetails = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "Menu"; DataRow dr; if (dsDetails.Tables["Menu"].Rows.Count > 0) { dr = dsDetails.Tables["Menu"].Rows[0]; this.txtMenuId.Text = dr["MenuId"].ToString(); this.txtMenuName.Text = dr["MenuName"].ToString(); this.txtMenuLink.Text = dr["menuLink"].ToString(); this.cboGroup.Value = dr["Parentid"].ToString(); this.chkDropdown.Checked = Boolean.Parse(dr["isInactive"].ToString()); //this.cboGroup.Text = dr["mMenuGroupCaption"].ToString(); //A.parentId, A.isInactive, A.isDefault //this.chkDropdown.Checked = false; //if (Int16.Parse(dr["isInactive"].ToString()) == 1) //{ // this.chkDropdown.Checked = true; //} //else //{ // this.chkDropdown.Checked = false; //} //if (Int16.Parse(dr["IsDropDownParent"].ToString()) == 1) //{ // this.chkIsDDParent.Checked = true; //} //this.cboDDParent.Value = dr["DropdownParentId"].ToString(); cboGroup.ValueMember = "Menuid"; cboGroup.DisplayMember = "MenuName"; this.btnSave.Text = "&Update"; this.btnDelete.Enabled = true; } } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { clsCon = null; } }
private void prcLoadCombo(string sqlQuery) { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsDetails = new System.Data.DataSet(); try { if (sqlQuery.Length == 0) { sqlQuery = "Exec prcGetPermission_ModuleUser 0, 0"; } clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "ModuleUser"; gridTran.DataSource = null; gridTran.DataSource = dsDetails; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { clsCon = null; } }
private void prcDisplayDetails(string strParam) { string sqlQuery = "Exec prcGetUser " + Common.Classes.clsMain.intUserId + "," + Int32.Parse(strParam); dsDetails = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "User"; DataRow dr; if (dsDetails.Tables["User"].Rows.Count > 0) { dr = dsDetails.Tables["User"].Rows[0]; this.txtUserId.Text = dr["LUserId"].ToString(); this.txtUserName.Text = clsProc.GTRDecryptWord(dr["LUserName"].ToString()); this.txtPassword.Text = clsProc.GTRDecryptWord(dr["LUserPass"].ToString()); this.txtConfirmPassword.Text = clsProc.GTRDecryptWord(dr["LUserPass"].ToString()); this.cboEmployee.Value = dr["EmpId"].ToString(); this.cboGroup.Text = dr["LSubGroupName"].ToString(); this.chkInactive.Checked = Boolean.Parse(dr["IsInactive"].ToString()); this.txtPassword.Enabled = false; this.txtConfirmPassword.Enabled = false; this.btnSave.Text = "&Update"; this.btnDelete.Enabled = true; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec WebprcGetWebUser " + Common.Classes.clsMain.intUserId + ", 0"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "tblWeb_User"; dsList.Tables[1].TableName = "tblWeb_User_1"; dsList.Tables[2].TableName = "tblWeb_User_Category"; dsList.Tables[3].TableName = "tblWeb_User_Type"; dsList.Tables[4].TableName = "tblWeb_SecurityQues"; dsList.Tables[5].TableName = "tblCat_Contact"; dsList.Tables[6].TableName = "tblCat_CustomerInfo"; dsList.Tables[7].TableName = "FieldName"; dsList.Tables[8].TableName = "FieldOperator"; //dsList.Tables[7].TableName = "tblWeb_User_Category"; dvgrid = dsList.Tables["tblWeb_User"].DefaultView; gridList.DataSource = null; gridList.DataSource = dvgrid; } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec prcGetPermission_Module " + clsMain.intUserId + ", 0"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "UserList"; prcModifyDataset(); gridList.DataSource = null; gridList.DataSource = dsList; } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnDelete_Click(object sender, EventArgs e) { if (MessageBox.Show("Do you want to delete user information of [" + txtUserName.Text + "]", "", System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No) { return; } GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { int Result = 0; string sqlQuery = ""; sqlQuery = "Delete from tblWeb_User Where UserID = " + Int32.Parse(txtUserId.Text); Result = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (Result > 0) { prcClearData(); txtUserName.Focus(); prcLoadList(); prcLoadList(); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec prcGetMenu 0"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "MenuList"; dsList.Tables[1].TableName = "ModuleList"; dsList.Tables[2].TableName = "GroupList"; dsList.Tables[3].TableName = "DropdownParent"; dsList.Tables[4].TableName = "FiledName"; dsList.Tables[5].TableName = "FiledOperator"; dvgrid = dsList.Tables["MenuList"].DefaultView; gridList.DataSource = null; gridList.DataSource = dvgrid; } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void prcLoadCombo(string sqlQuery) { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsDetails = new System.Data.DataSet(); try { if (sqlQuery.Length == 0) { sqlQuery = "Exec WebprcPermission_MenuUser_Web 0"; } clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "MenuGroup"; dsDetails.Tables[1].TableName = "MenuItem"; DataRelation rel = new DataRelation("relMenu", dsDetails.Tables["MenuGroup"].Columns["MenuGroupId"], dsDetails.Tables["MenuItem"].Columns["MenuGroupId"]); dsDetails.Relations.Add(rel); gridTran.DataSource = null; gridTran.DataSource = dsDetails; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); string sqlQuery = ""; Int32 NewId = 0; try { //To Delete Existing Data sqlQuery = " Delete from tblWeb_User_Menu Where UserId = " + gridList.ActiveRow.Cells["userid"].Text.ToString() + ""; arQuery.Add(sqlQuery); //To Insert Data With New Value foreach (UltraGridRow row in this.gridTran.Rows) { if (Int16.Parse(row.Cells["IsAllow"].Text.ToString()) != 0) { sqlQuery = " Insert Into tblWeb_User_Menu (UserId, menuId, SortNo) "; sqlQuery += " Values ( " + gridList.ActiveRow.Cells["userid"].Text.ToString() + ", " + Int32.Parse(row.Cells["menuId"].Text.ToString()) + ", " + Int32.Parse(row.Cells["aId"].Text.ToString()) + ")"; arQuery.Add(sqlQuery); // Get the child rows for each of the parent rows and set the checked state foreach (UltraGridRow childRow in row.ChildBands[0].Rows) { if (Int16.Parse(childRow.Cells["IsAllow"].Text.ToString()) != 0) { sqlQuery = " Insert Into tblWeb_User_Menu (UserId, menuId, SortNo) "; sqlQuery += " Values ( " + gridList.ActiveRow.Cells["userid"].Text.ToString() + ", " + Int32.Parse(childRow.Cells["menuId"].Text.ToString()) + ", " + Int32.Parse(childRow.Cells["aId"].Text.ToString()) + ")"; arQuery.Add(sqlQuery); } } } } clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); prcClearData(); prcLoadList(); prcLoadCombo(""); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec prcGetUserSingle 0," + Common.Classes.clsMain.intUserId + ""; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "tbluser"; DataRow dr; if (dsList.Tables["tbluser"].Rows.Count > 0) { dr = dsList.Tables["tbluser"].Rows[0]; this.txtUserID.Text = clsProc.GTRDecryptWord(dr["luserName"].ToString()).ToString(); this.txtUserName.Text = (dr["empname"].ToString()); } //Load for Filter Filed oparator Name //cboFilterOperator.DataSource = null; //cboFilterOperator.DataSource = dsList.Tables["FilterOperetor"]; } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec prcGetUserMenuPermission " + Common.Classes.clsMain.intUserId + ", 0,0"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "UserList"; dsList.Tables[1].TableName = "UserListTran"; prcModifyDataset(); gridList.DataSource = null; gridList.DataSource = dsList.Tables["UserList"]; prcModifyDataset1(); gridListTran.DataSource = null; gridListTran.DataSource = dsList.Tables["UserListTran"]; } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void prcDisplayDetails(string strParam) { string sqlQuery = "Exec prcGetModule " + Int32.Parse(strParam); dsDetails = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "Module"; DataRow dr; if (dsDetails.Tables["Module"].Rows.Count > 0) { dr = dsDetails.Tables["Module"].Rows[0]; this.txtModuleId.Text = dr["ModuleId"].ToString(); this.txtModuleName.Text = dr["ModuleName"].ToString(); this.txtModuleCaption.Text = dr["ModuleCaption"].ToString(); if (Int16.Parse(dr["IsInactive"].ToString()) == 0) { this.chkInactive.Checked = false; } else { this.chkInactive.Checked = true; } this.btnSave.Text = "&Update"; this.btnDelete.Enabled = true; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); string sqlQuery = ""; Int32 NewId = 0; try { //Member Master Table if (txtUserId.Text.Length != 0) { //Update sqlQuery = " Update tblWeb_User Set UserName = '******', UserPass='******', "; sqlQuery = sqlQuery + " SecQuestion ='" + cboQuestion.Text + "', SecAnswer ='" + cboAnswer.Text + "',IsInactive=" + chkInactive.Tag + ", DisplayName ='" + txtDisplayName.Text + "',userTypeId = " + cboUsType.Value + " , userCatId = '" + cboGroup.Value + "',RefId = " + cboRefName.Value + ",RelId = '" + cboRelation.Value + "' Where UserID = '" + Int32.Parse(txtUserId.Text) + "'"; NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); //if (NewId > 0) //{ MessageBox.Show("Data Updated Successfully"); //} } else { //add new sqlQuery = "Select Isnull(Max(UserID),0)+1 As NewId from tblWeb_User"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "insert into tblWeb_User (userId,userName,userPass,SecQuestion,SecAnswer,isInactive,userTypeId,userCatId,RefId,RelId,DisplayName)"; sqlQuery = sqlQuery + " Values (" + NewId + ", '" + txtUserName.Text.ToString() + "', '" + txtPassword.Text.ToString() + "','" + cboQuestion.Text.ToString() + "','" + cboAnswer.Text.ToString() + "'," + chkInactive.Tag + "," + cboUsType.Value + " ," + cboGroup.Value + ", " + cboRefName.Value + ",'" + cboRelation.Value + "','" + txtDisplayName.Text.ToString() + "')"; NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Saved Successfully"); } } prcClearData(); txtUserName.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //Member Master Table if (txtGroupId.Text.Length != 0) { //Update sqlQuery = " Update tblLogin_Group_Sub Set LSubGroupName = '" + txtGroupName.Text.ToString() + "'"; sqlQuery += " Where LSubGroupId = " + Int32.Parse(txtGroupId.Text); NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Updated Successfully"); } } else { //add new sqlQuery = "Select Isnull(Max(LSubGroupId),0)+1 As NewId from tblLogin_Group_Sub"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Insert Into tblLogin_Group_Sub (LSubGroupId, aId, LSubGroupName, LGroupId) "; sqlQuery += " Values (" + NewId + ", " + NewId + ", '" + txtGroupName.Text.ToString() + "',2)"; NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Saved Successfully"); } } prcClearData(); txtGroupName.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
public void prcGetData(ref System.Data.DataSet dsMenu) { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); clsCon.GTRFillDatasetWithSQLCommand(ref dsMenu, "Exec prcGetMenuPermission " + (Int32)Classes.clsMain.intUserId); dsMenu.Tables[0].TableName = "Module"; dsMenu.Tables[1].TableName = "Group"; dsMenu.Tables[2].TableName = "Menu"; dsMenu.Tables[3].TableName = "Company"; }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //To Delete Existing Data sqlQuery = "Delete from tblUser_Module Where LUserId = " + (Int32.Parse(txtUserId.Text)); //To Insert Data With New Value Int16 isAllow = 0; Int16 isDefault = 0; Int16 sortNo = 0; foreach (Infragistics.Win.UltraWinGrid.UltraGridRow row in this.gridTran.Rows) { if (Int16.Parse(row.Cells["IsAllow"].Text.ToString()) != 0) { sqlQuery = sqlQuery + " Insert Into tblUser_Module (LUserId, moduleId, IsDefault, sortNo) "; sqlQuery = sqlQuery + " Values (" + Int32.Parse(txtUserId.Text) + ", " + Int32.Parse(row.Cells["moduleId"].Text.ToString()) + ", " + Int32.Parse(row.Cells["isDefault"].Text.ToString()) + ", " + Int32.Parse(row.Cells["sortNo"].Text.ToString()) + ")"; } } NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Saved Successfully"); } prcClearData(); prcLoadList(); prcLoadCombo(""); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //Check old password System.Data.DataSet ds = new System.Data.DataSet(); sqlQuery = "Select * from tblLogin_user Where LUserId = " + Common.Classes.clsMain.intUserId + ""; clsCon.GTRFillDatasetWithSQLCommand(ref ds, sqlQuery); if (ds.Tables[0].Rows.Count == 0) { MessageBox.Show("Please provide valid old password"); txtOldPassword.Focus(); return; } ds = null; //Update database sqlQuery = " Update tblLogin_User Set LUserPass='******' Where LUserId = " + Common.Classes.clsMain.intUserId + ""; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void gridList_DoubleClick(object sender, EventArgs e) { prcClearData(); //txtUserId.Text = gridList.ActiveRow.Cells[0].Value.ToString(); string sqlQuery = "Exec WebprcPermission_MenuUser_Web " + gridList.ActiveRow.Cells[0].Text.ToString() + ""; //DataRelation rel = new DataRelation("relMenu", dsDetails.Tables["MenuGroup"].Columns["MenuGroupId"], dsDetails.Tables["MenuItem"].Columns["MenuGroupId"]); //dsDetails.Relations.Add(rel); //gridTran.DataSource = null; //gridTran.DataSource = dsDetails; GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsCombo = new System.Data.DataSet(); try { clsCon.GTRFillDatasetWithSQLCommand(ref dsCombo, sqlQuery); dsCombo.Tables[0].TableName = "MenuGroup"; dsCombo.Tables[1].TableName = "MenuItem"; DataRelation rel = new DataRelation("relMenu", dsCombo.Tables["MenuGroup"].Columns["MenuGroupId"], dsCombo.Tables["MenuItem"].Columns["MenuGroupId"]); dsCombo.Relations.Add(rel); gridTran.DataSource = null; gridTran.DataSource = dsCombo; //cboModule.DataSource = null; //cboModule.DataSource = dsCombo; //cboModule.DisplayMember = "moduleCaption"; //cboModule.ValueMember = "moduleId"; } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } finally { clsCon = null; } }
private void prcLoadlist1(string txt) { dsFilter1 = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); string sqlQuery; try { //string str = "%" + txt + "%"; if (txt == "Employee") { sqlQuery = "select empID as ID,'[ '+ empCode +' ] - ' + empName COLLATE DATABASE_DEFAULT as Name from tblEmp_Info order by EmpID"; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter1, sqlQuery); } else if (txt == "Client") { sqlQuery = "select Custid as ID,'[ '+ Custcode +' ] - ' + Custname COLLATE DATABASE_DEFAULT as Name from tblCat_CustomerInfo order by custname"; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter1, sqlQuery); } else if (txt == "Supplier") { sqlQuery = "select supplierId as ID,'[ '+ SupplierCode +' ] - ' + supplierName COLLATE DATABASE_DEFAULT as Name from tblCat_Supplier order by supplierName"; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter1, sqlQuery); } else if (txt == "Dealer") { sqlQuery = "select Dlrid as ID,'[ '+ DlrCode +' ] - ' + DlrName COLLATE DATABASE_DEFAULT as Name from tblCat_DealerInfo order by DlrName"; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter1, sqlQuery); } dsFilter1.Tables[0].TableName = "as"; cboRefName.DataSource = null; cboRefName.DataSource = dsFilter1.Tables["as"]; cboRefName.DisplayMember = "name"; cboRefName.ValueMember = "id"; } catch (Exception ex) { // throw (ex); } }
private void btnSave_Click(object sender, EventArgs e) { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); try { string LUserId = gridList.ActiveRow.Cells["LUserId"].Value.ToString(); string LUserIdTran = gridListTran.ActiveRow.Cells["LUserId"].Value.ToString(); string sqlQuery = "Exec prcGetUserMenuPermission " + Common.Classes.clsMain.intUserId + ", " + LUserId + "," + LUserIdTran + ""; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); // Insert Information To Log File string sqlQuery1 = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType)" + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Save')"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery1); //// Insert Information To Log File //string sqlQuery1 = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, PCName, tranType)" // + " Values (" + GTRHRIS.Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + // "','" + sqlQuery.Replace("'", "|") + "','" + Common.Classes.clsMain.strComputerName + "','Save')"; //arQuery.Add(sqlQuery); ////Transaction with database //clsCon.GTRSaveDataWithSQLCommand(arQuery); //MessageBox.Show("Data Updated Successfully"); MessageBox.Show("Data Saved Successfully"); prcClearData(); prcLoadList(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } }
private void prcDisplayDetails(string strParam) { string sqlQuery = "Exec WebprcGetWebUser " + Common.Classes.clsMain.intUserId + "," + Int32.Parse(strParam); dsDetails = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "User"; DataRow dr; if (dsDetails.Tables["User"].Rows.Count > 0) { dr = dsDetails.Tables["User"].Rows[0]; this.txtUserId.Text = dr["UserID"].ToString(); this.txtUserName.Text = dr["UserName"].ToString(); this.txtPassword.Text = dr["UserPass"].ToString(); this.txtConfirmPassword.Text = dr["UserPass"].ToString(); this.chkInactive.Checked = Boolean.Parse(dr["IsInactive"].ToString()); this.cboQuestion.Text = dr["SecQuestion"].ToString(); this.cboAnswer.Text = dr["SecAnswer"].ToString(); this.txtDisplayName.Text = dr["DisplayName"].ToString(); this.cboUsType.Value = dr["userTypeId"].ToString(); this.cboGroup.Value = dr["userCatId"].ToString(); this.cboRefName.Value = dr["refid"].ToString(); this.cboRelation.Value = dr["RelId"].ToString(); //this.chkInactive.CheckedValue = dr["isInactive"].ToString(); this.txtPassword.Enabled = false; this.txtConfirmPassword.Enabled = false; this.btnSave.Text = "&Update"; this.btnDelete.Enabled = true; } }
private void prcLoadlist2(string txt, string int1) { dsFilter2 = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); string sqlQuery; try { //string str = "%" + txt + "%"; if (txt == "Client" || txt == "Customer") { sqlQuery = "select contID as ID,'[ '+ contCode +' ] - ' + contName COLLATE DATABASE_DEFAULT as Name from tblCat_Contact where TypeName = 'Customer' and DataID = " + int1 + " "; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter2, sqlQuery); } else if (txt == "Supplier") { sqlQuery = "select contID as ID,'[ '+ contCode +' ] - ' + contName COLLATE DATABASE_DEFAULT as Name from tblCat_Contact where TypeName = 'Supplier' and DataID = " + int1 + " order by Name"; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter2, sqlQuery); } else if (txt == "Dealer") { sqlQuery = "select contID as ID,'[ '+ contCode +' ] - ' + contName COLLATE DATABASE_DEFAULT as Name from tblCat_Contact where TypeName = 'Supplier' and DataID = " + int1 + " order by Name"; clsCon.GTRFillDatasetWithSQLCommand(ref dsFilter2, sqlQuery); } dsFilter2.Tables[0].TableName = "as"; cboRelation.DataSource = null; cboRelation.DataSource = dsFilter2.Tables["as"]; cboRelation.DisplayMember = "name"; cboRelation.ValueMember = "id"; } catch (Exception ex) { throw (ex); } }
private void prcDisplayDetails(string strParam) { string sqlQuery = "Exec prcGetUserGroup " + Common.Classes.clsMain.intUserId + "," + Int32.Parse(strParam); dsDetails = new System.Data.DataSet(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); clsCon.GTRFillDatasetWithSQLCommand(ref dsDetails, sqlQuery); dsDetails.Tables[0].TableName = "Group"; DataRow dr; if (dsDetails.Tables["Group"].Rows.Count > 0) { dr = dsDetails.Tables["Group"].Rows[0]; this.txtGroupId.Text = dr["LSubGroupId"].ToString(); this.txtGroupName.Text = dr["LSubGroupName"].ToString(); this.btnSave.Text = "&Update"; this.btnDelete.Enabled = true; } }
private void prcLoadList() { GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); try { string sqlQuery = "Exec prcGetModule 0"; clsCon.GTRFillDatasetWithSQLCommand(ref dsList, sqlQuery); dsList.Tables[0].TableName = "ModuleList"; gridList.DataSource = null; gridList.DataSource = dsList; } catch (Exception ex) { throw (ex); } finally { clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int32 NewId = 0, ImageExist = 0, menuImageSize = 0; if (optImageUse.Value.ToString() != "0") { ImageExist = Int16.Parse(optImageUse.Value.ToString()); menuImageSize = Int16.Parse(optImageUse.Value.ToString()); } cboDDParent.Tag = "0"; if (chkDropdown.Checked) { if (chkIsDDParent.Checked == false) { cboDDParent.Tag = cboDDParent.Value.ToString(); } } try { //Member Master Table if (txtMenuId.Text.Length != 0) { //Update sqlQuery = " Update tblModule_Menu Set MenuName = '" + txtMenuName.Text.ToString() + "', MenuCaption='" + txtMenuCaption.Text.ToString() + "', " + " mMenuGroupId = " + cboGroup.Value + ", MenuImageExist = " + ImageExist + ", MenuImageSize = " + menuImageSize + ", menuImageName='" + txtImageName.Text.Trim() + "', " + " frmName = '" + txtFormName.Text.Trim() + "', frmLocation = '" + txtFormLocation.Text.Trim() + "', IsDropDown=" + chkDropdown.Tag.ToString() + ", IsDropDownParent=" + chkIsDDParent.Tag.ToString() + ", DropDownParentId = " + cboDDParent.Tag.ToString() + "" + ", PCName='" + Common.Classes.clsMain.strComputerName + "', LUserId = " + Common.Classes.clsMain.intUserId + "" + " Where MenuId= " + Int32.Parse(txtMenuId.Text); arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } else { //add new sqlQuery = "Select Isnull(Max(MenuId),0)+1 As NewId from tblModule_Menu"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Insert Into tblModule_Menu (MenuId, Aid, MenuName, MenuCaption, mMenuGroupId, menuImageExist, menuImageSize, menuImageName, frmName, frmLocation, IsDropDown, IsDropDownParent, DropDownParentId, PCName, LUserId) " + " Values (" + NewId + ", " + NewId + ", '" + txtMenuName.Text.ToString() + "', '" + txtMenuCaption.Text.ToString() + "', " + cboGroup.Value + "," + ImageExist + "," + menuImageSize + ",'" + txtImageName.Text.Trim() + "', '" + txtFormName.Text.Trim() + "','" + txtFormLocation.Text.Trim() + "'," + chkDropdown.Tag.ToString() + "," + chkIsDDParent.Tag.ToString() + ", " + cboDDParent.Tag.ToString() + ", '" + Common.Classes.clsMain.strComputerName + "'," + Common.Classes.clsMain.intUserId + ")"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); } #region CopyImage if (txtImageName.Text.Length != 0) { if (txtImageName.Tag != null)//If New Image then it will be copy else no need to copy { string strTarget = Common.Classes.clsMain.strPicPathIcon + @"\" + txtImageName.Text; File.Copy(txtImageName.Tag.ToString(), strTarget, true); } } #endregion prcClearData(); txtMenuName.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
private void btnSave_Click(object sender, EventArgs e) { if (fncBlank()) { return; } ArrayList arQuery = new ArrayList(); GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); string sqlQuery = ""; Int32 NewId = 0; try { //Member Master Table if (txtModuleId.Text.Length != 0) { //Update sqlQuery = " Update tblModule Set ModuleName = '" + txtModuleName.Text.ToString() + "', ModuleCaption='" + txtModuleCaption.Text.ToString() + "', " + " IsInactive=" + chkInactive.Tag + ", PCName='" + Common.Classes.clsMain.strComputerName + "', LUserId = " + Common.Classes.clsMain.intUserId + "" + " Where ModuleId = " + Int32.Parse(txtModuleId.Text); arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Update')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Updated Successfully"); } else { //add new sqlQuery = "Select Isnull(Max(ModuleId),0)+1 As NewId from tblModule"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Insert Into tblModule (ModuleId, aId, ModuleName, ModuleCaption, IsInactive, PCName, LUserId) " + " Values (" + NewId + ", " + NewId + ", '" + txtModuleName.Text.ToString() + "', '" + txtModuleCaption.Text.ToString() + "', " + chkInactive.Tag + ", '" + Common.Classes.clsMain.strComputerName + "'," + Common.Classes.clsMain.intUserId + ")"; arQuery.Add(sqlQuery); // Insert Information To Log File sqlQuery = "Insert Into tblUser_Trans_Log (LUserId, formName, tranStatement, tranType)" + " Values (" + Common.Classes.clsMain.intUserId + ", '" + this.Name.ToString() + "','" + sqlQuery.Replace("'", "|") + "','Insert')"; arQuery.Add(sqlQuery); //Transaction with database clsCon.GTRSaveDataWithSQLCommand(arQuery); MessageBox.Show("Data Saved Successfully"); } prcClearData(); txtModuleName.Focus(); prcLoadList(); prcLoadCombo(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { arQuery = null; clsCon = null; } }
//private void btnUpgrade_Click(object sender, EventArgs e) //{ // //this.WindowState = FormWindowState.Minimized; // GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); // System.Data.DataSet dsAutoupdate = new System.Data.DataSet(); // try // { // string sqlQuery = // "Select top(1) AutoDownload_ID,LuserID,FileType,FileFormate, FileName, FilePath, FileSourceName, IsDownLoad, VershionNo From tbl_AutoUpdate where IsDownLoad=0 Order by AutoDownload_ID Desc"; // clsCon.GTRFillDatasetWithSQLCommand(ref dsAutoupdate, sqlQuery); // dsAutoupdate.Tables[0].TableName = "AutoUpdate"; // if (dsAutoupdate.Tables["AutoUpdate"].Rows.Count > 0) // { // dr = dsAutoupdate.Tables[0].Rows[0]; // if (dr["VershionNo"].ToString() != OV) // { // DownloadFile(dr["FileSourceName"].ToString(), Application.StartupPath + "/" + dr["FileSourceName"].ToString().Substring(dr["FileSourceName"].ToString().LastIndexOf("/") + 1)); // } // else // { // MessageBox.Show("You Already updatet"); // } // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // } // finally // { // clsCon = null; // } //} //private void btnUpgrade_Click(object sender, EventArgs e) //{ // try // { // string asd = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 1).ToString() + "GTRHRISOld.exe"; // if (File.Exists(asd)) // { // File.Delete(asd); // } // if (dr["FileFormate"].ToString().ToUpper() == "EXE".ToUpper() || dr["FileFormate"].ToString().ToUpper() == "ALL".ToUpper()) // { // System.IO.File.Move(Application.ExecutablePath, // Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 1) + "GTRHRISOld.exe"); // } // using (Stream stream = File.OpenRead(Application.StartupPath + "/" + dr["FileSourceName"].ToString().Substring(dr["FileSourceName"].ToString().LastIndexOf("/") + 1))) // { // var reader = ReaderFactory.Open(stream); // Properties.Settings.Default.AUId = dr["AutoDownload_ID"].ToString(); // Properties.Settings.Default.Save(); // while (reader.MoveToNextEntry()) // { // if (!reader.Entry.IsDirectory) // { // Console.WriteLine(reader.Entry.FilePath); // reader.WriteEntryToDirectory(Application.StartupPath + "/", // ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); // } // } // } // } // catch (Exception ex) // { // MessageBox.Show(ex.Message); // return; // } //} private void btnUpgrade_Click(object sender, EventArgs e) { //this.WindowState = FormWindowState.Minimized; GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); System.Data.DataSet dsAutoupdate = new System.Data.DataSet(); try { if (File.Exists(FileLocation + "\\Debug.rar")) { File.Delete(FileLocation + "\\Debug.rar"); } string fileName = "Debug.rar"; string sourcePath = @"\\YABDPAYROLL\GTR Exe Update"; //@"Z:\Regency"; string targetPath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 0).ToString(); //@"C:\Program Files\Microsoft\Regency_Setup"; // Use Path class to manipulate file and directory paths. string sourceFile = System.IO.Path.Combine(sourcePath, fileName); string destFile = System.IO.Path.Combine(targetPath, fileName); // To copy a folder's contents to a new location: // Create a new target folder, if necessary. if (!System.IO.Directory.Exists(targetPath)) { System.IO.Directory.CreateDirectory(targetPath); } // To copy a file to another location and // overwrite the destination file if it already exists. System.IO.File.Copy(sourceFile, destFile, true); // To copy all the files in one directory to another directory. // Get the files in the source folder. (To recursively iterate through // all subfolders under the current directory, see // "How to: Iterate Through a Directory Tree.") // Note: Check for target path was performed previously // in this code example. if (System.IO.Directory.Exists(sourcePath)) { string[] files = System.IO.Directory.GetFiles(sourcePath); // Copy the files and overwrite destination files if they already exist. foreach (string s in files) { // Use static Path methods to extract only the file name from the path. fileName = System.IO.Path.GetFileName(s); destFile = System.IO.Path.Combine(targetPath, fileName); System.IO.File.Copy(s, destFile, true); } } else { Console.WriteLine("Source path does not exist!"); } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { clsCon = null; } if (File.Exists(FileLocation + "\\GTRHRISOLD.exe")) { File.Delete(FileLocation + "\\GTRHRISOLD.exe"); } System.IO.File.Move(Application.ExecutablePath, Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 1) + "GTRHRISOld.exe"); if (File.Exists(FileLocation + "\\GTRHRIS.exe")) { File.Delete(FileLocation + "\\GTRHRIS.exe"); } //string path = @"C:\Program Files\Microsoft\Regency_Setup\Debug.rar"; //string spath = @"C:\Program Files\Microsoft\Regency_Setup"; string path = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 0).ToString() + "\\Debug.rar"; string spath = Application.ExecutablePath.Substring(0, Application.ExecutablePath.LastIndexOf("\\") + 0).ToString(); using (Stream stream = File.OpenRead(path)) { var reader = ReaderFactory.Open(stream); Properties.Settings.Default.Save(); reader.WriteAllToDirectory(spath, ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite); } Application.Exit(); }