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;
            }
        }
Exemple #2
0
        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 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;
            }
        }
Exemple #4
0
        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;
            }
        }
Exemple #5
0
        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;
            }
        }
Exemple #6
0
        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 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;
            }
        }
Exemple #8
0
        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;
            }
        }
Exemple #10
0
        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;
            }
        }