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; } }
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 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; } GTRLibrary.clsConnection clsCon = new GTRLibrary.clsConnection(); dsList = new System.Data.DataSet(); string sqlQuery = ""; Int32 NewId = 0, ImageExist = 0, menuImageSize = 0; try { //Member Master Table if (txtMenuId.Text.Length != 0) { //Update sqlQuery = " Update tblWeb_Menu Set MenuName = '" + txtMenuName.Text.ToString() + "', MenuLink='" + txtMenuLink.Text.ToString() + "', "; sqlQuery += " parentid = " + cboGroup.Value + ", "; sqlQuery += " isInActive=" + chkDropdown.Tag.ToString() + ""; sqlQuery += " Where MenuId= " + Int32.Parse(txtMenuId.Text); NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Updated Successfully"); } } else { //add new sqlQuery = "Select Isnull(Max(MenuId),0)+1 As NewId from tblWeb_Menu"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Insert Into tblWeb_Menu (MenuId, MenuName, MenuLink,Parentid, isInactive) "; sqlQuery = sqlQuery + " Values (" + NewId + ", '" + txtMenuName.Text.ToString() + "', '" + txtMenuLink.Text.ToString() + "', " + cboGroup.Value + "," + chkDropdown.Tag.ToString() + ")"; NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Saved Successfully"); } } prcClearData(); txtMenuName.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 (txtUserId.Text.Length != 0) { //Update sqlQuery = " Update tblLogin_User Set LUserName = '******', LUserPass='******', "; sqlQuery += " LSubGroupId = " + cboGroup.Value + ", IsInactive=" + chkInactive.Tag + ", EmpId = " + cboEmployee.Value.ToString() + ""; sqlQuery += " Where LUserId = " + Int32.Parse(txtUserId.Text); NewId = clsCon.GTRSaveDataWithSQLCommand(sqlQuery); if (NewId > 0) { MessageBox.Show("Data Updated Successfully"); } //MessageBox.Show(clsProc.GTRDecryptWord(txtPassword.Text.ToString())); } else { //add new sqlQuery = "Select Isnull(Max(LUserId),0)+1 As NewId from tblLogin_User"; NewId = clsCon.GTRCountingData(sqlQuery); sqlQuery = "Insert Into tblLogin_UserSalary (LUserId,ComID,isActiveSalary,isActiveSalaryOver,isActiveSalaryLess,EmpID,Amount)"; sqlQuery += " Values (" + NewId + ", " + Common.Classes.clsMain.intComId + ",0,0,0,0,0)"; clsCon.GTRSaveDataWithSQLCommand(sqlQuery); sqlQuery = "Insert Into tblLogin_User (LUserId, aId, LUserName, LUserPass, LSubGroupId, IsInactive, EmpId) "; sqlQuery += " Values (" + NewId + ", " + NewId + ", '" + clsProc.GTREncryptWord(txtUserName.Text.ToString()) + "', '" + clsProc.GTREncryptWord(txtPassword.Text.ToString()) + "', " + cboGroup.Value.ToString() + ", " + chkInactive.Tag.ToString() + ", " + cboEmployee.Value.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; } }