Пример #1
0
        private bool ValidateFields()
        {
            // Check the selected branch is blank or not
            if (cmbBranch.Text.Trim() == "")
            {
                cmnService.J_UserMessage("Please select the Branch !!");
                cmbBranch.Focus();
                return(false);
            }

            // Check the selected Login Id is blank or not
            if (cmbLoginId.Text.Trim() == "")
            {
                cmnService.J_UserMessage("Please select the Login Id !!");
                cmbLoginId.Focus();
                return(false);
            }

            // Check the Password is blank or not
            if (txtPassword.Text == "")
            {
                cmnService.J_UserMessage("Please enter the password !!");
                txtPassword.Focus();
                return(false);
            }

            // Check the Password is invalid or not
            if (cmbLoginId.Text.ToUpper() == "ADMIN")
            {
                if (dmlService.J_IsRecordExist("MST_USER",
                                               "    " + cmnService.J_SQLDBFormat("LOGIN_ID", J_SQLColFormat.UCase) + " = '" + cmnService.J_ReplaceQuote(cmbLoginId.Text.ToUpper()) + "' " +
                                               "AND USER_PASSWORD = '******'") == false)
                {
                    cmnService.J_UserMessage(J_Msg.InvalidPassword);
                    txtPassword.Focus();
                    return(false);
                }
            }
            else if (cmbLoginId.Text.ToUpper() != "ADMIN")
            {
                if (dmlService.J_IsRecordExist("MST_USER",
                                               "    BRANCH_ID     =  " + J_Var.J_pBranchId + " " +
                                               "AND " + cmnService.J_SQLDBFormat("LOGIN_ID", J_SQLColFormat.UCase) + " = '" + cmnService.J_ReplaceQuote(cmbLoginId.Text.ToUpper()) + "' " +
                                               "AND USER_PASSWORD = '******'") == false)
                {
                    cmnService.J_UserMessage(J_Msg.InvalidPassword);
                    txtPassword.Focus();
                    return(false);
                }
            }

            // Check the selected F.A. Year is blank or not
            if (cmbFAYear.SelectedIndex < 0)
            {
                cmnService.J_UserMessage("Please select the FA Year");
                cmbFAYear.Focus();
                return(false);
            }
            return(true);
        }
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateFields() == false)
                {
                    return;
                }

                Hashtable nameValue = new Hashtable();

                nameValue.Add("SERVERNAME", this.strServerName);
                nameValue.Add("DATABASENAME", this.strDatabaseName);
                nameValue.Add("USERNAME", this.strUserName);
                nameValue.Add("PASSWORD", this.strPassword);

                XMLService objxml = new XMLService();
                objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName);

                if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == true)
                {
                    // Close & Dispose the MstLogin Class
                    this.Close();
                    this.Dispose();

                    if (dmlService.J_IsRecordExist("MST_FAYEAR") == true)
                    {
                        CmnLogin frm = new CmnLogin();
                        frm.ShowDialog();
                        frm.Dispose();
                    }
                    else
                    {
                        CmnCreate1stFAYear frm = new CmnCreate1stFAYear();
                        frm.ShowDialog();
                        frm.Dispose();
                    }
                    return;
                }
                else
                {
                    cmnService.J_UserMessage("Invalid database structure.\nPlease check the database");
                    txtServerName.Focus();
                    return;
                }
            }
            catch (Exception err_handler)
            {
                cmnService.J_UserMessage(err_handler.Message);
            }
        }
Пример #3
0
 public bool CheckRights(string MenuName)
 {
     if (J_Var.J_pLoginId.ToUpper() != "ADMIN")
     {
         if (dmlService.J_IsRecordExist("MST_MENU, MST_USER_RIGHTS",
                                        "    MST_MENU.MENU_ID         = MST_USER_RIGHTS.MENU_ID " +
                                        "AND MST_MENU.MENU_VISIBILITY = 0 " +
                                        "AND MST_USER_RIGHTS.USER_ID  = " + J_Var.J_pUserId + " " +
                                        "AND " + cmnService.J_SQLDBFormat("MST_MENU.MENU_NAME", J_SQLColFormat.UCase) + " = '" + MenuName.ToUpper() + "'") == false)
         {
             cmnService.J_UserMessage(J_Msg.InsufficientRights);
             return(false);
         }
     }
     return(true);
 }
        private void cmbUserId_SelectedIndexChanged(object sender, EventArgs e)
        {
            PopulateDetailGrid();
            if (cmbUserId.SelectedIndex <= 0)
            {
                return;
            }

            foreach (DataGridViewRow row in grdvDescription.Rows)
            {
                if (dmlService.J_IsRecordExist("MST_USER_RIGHTS",
                                               "    USER_ID = " + Convert.ToInt64(Support.GetItemData(cmbUserId, cmbUserId.SelectedIndex)) + " " +
                                               "AND MENU_ID = " + Convert.ToInt64(Convert.ToString(row.Cells[1].Value)) + "") == true)
                {
                    row.Cells[0].Value = true;
                }
            }
        }
        private bool InsertMenuData(long MenuId,
                                    string GroupCode,
                                    string MenuGroup,
                                    string SLNo,
                                    string MenuName,
                                    string MenuDesc,
                                    string MenuSubDesc_1,
                                    bool MenuVisibility)
        {
            if (dmlService.J_IsRecordExist("MST_MENU", "MENU_ID = " + MenuId + "") == true)
            {
                return(true);
            }

            int intMenuVisibility = 0;

            if (MenuVisibility == false)
            {
                intMenuVisibility = 1;
            }

            strSQL = "INSERT INTO MST_MENU (" +
                     "            MENU_ID," +
                     "            MENU_GROUP_CODE," +
                     "            MENU_GROUP_NAME," +
                     "            MENU_SLNO," +
                     "            MENU_NAME," +
                     "            MENU_DESC," +
                     "            MENU_SUB_DESC_1," +
                     "            MENU_VISIBILITY) " +
                     "VALUES    ( " + MenuId + "," +
                     "           '" + GroupCode + "'," +
                     "           '" + MenuGroup + "'," +
                     "           '" + SLNo + "'," +
                     "           '" + MenuName + "'," +
                     "           '" + MenuDesc + "'," +
                     "           '" + MenuSubDesc_1 + "'," +
                     "            " + intMenuVisibility + ")";
            if (dmlService.J_ExecSql(strSQL) == false)
            {
                return(false);
            }
            return(true);
        }
Пример #6
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateFields() == false)
                {
                    return;
                }

                Hashtable nameValue = new Hashtable();

                nameValue.Add("SERVERNAME", cmbServers.Text.Trim());
                nameValue.Add("DATABASENAME", cmbDatabase.Text.Trim());
                nameValue.Add("USERNAME", txtDatabaseUserName.Text.Trim());
                nameValue.Add("PASSWORD", txtDatabasePassword.Text.Trim());

                XMLService xml = new XMLService();
                xml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName);

                // Close & Dispose the MstLogin Class
                this.Close();
                this.Dispose();

                if (dml.J_IsRecordExist("MST_FAYEAR") == true)
                {
                    CmnLogin frm = new CmnLogin();
                    frm.ShowDialog();
                    frm.Dispose();
                }
                else
                {
                    CmnCreate1stFAYear frm = new CmnCreate1stFAYear();
                    frm.ShowDialog();
                    frm.Dispose();
                }
            }
            catch (Exception err_handler)
            {
                cmn.J_UserMessage(err_handler.Message);
            }
        }
Пример #7
0
        private bool ValidateFields()
        {
            try
            {
                if (lblSearchMode.Text == J_Mode.Sorting)
                {
                    if (Convert.ToInt64(Convert.ToString(ViewGrid.CurrentRowIndex)) < 0)
                    {
                        cmnService.J_UserMessage(J_Msg.DataNotFound);
                        if (dsetGridClone == null)
                        {
                            return(false);
                        }
                        dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "PARTY_ID", lngSearchId);
                        return(false);
                    }
                    return(true);
                }
                else if (lblSearchMode.Text == J_Mode.Searching)
                {
                    if (grpSearch.Visible == false)
                    {
                        if (Convert.ToInt64(Convert.ToString(ViewGrid.CurrentRowIndex)) < 0)
                        {
                            cmnService.J_UserMessage(J_Msg.DataNotFound);
                            if (dsetGridClone == null)
                            {
                                return(false);
                            }
                            dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "PARTY_ID", lngSearchId);
                            return(false);
                        }
                    }
                    else if (grpSearch.Visible == true)
                    {
                        if (txtPartyNameSearch.Text.Trim() == "")
                        {
                            cmnService.J_UserMessage(J_Msg.SearchingValues);
                            txtPartyNameSearch.Select();
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                {
                    // Company Name
                    if (txtPartyName.Text.Trim() == "")
                    {
                        cmnService.J_UserMessage("Please enter the Party Name.");
                        txtPartyName.Select();
                        return(false);
                    }



                    // Duplicacy check with repect to the mode
                    if (lblMode.Text == J_Mode.Add)
                    {
                        // Duplicacy check with respect to Branch id
                        if (dmlService.J_IsRecordExist("MST_PARTY",
                                                       "    PARTY_NAME          = '" + cmnService.J_ReplaceQuote(txtPartyName.Text) + "' " +
                                                       "AND BRANCH_ID          =  " + J_Var.J_pBranchId) == true)
                        {
                            cmnService.J_UserMessage(J_Msg.DuplicateCode);
                            txtPartyName.Select();
                            return(false);
                        }
                    }
                    else if (lblMode.Text == J_Mode.Edit)
                    {
                        //  Duplicacy check with respect to Branch id
                        if (dmlService.J_IsRecordExist("MST_PARTY",
                                                       "    PARTY_NAME          = '" + cmnService.J_ReplaceQuote(txtPartyName.Text) + "' " +
                                                       "AND BRANCH_ID          =  " + J_Var.J_pBranchId + " " +
                                                       "AND PARTY_ID           <>  " + lngSearchId + "") == true)
                        {
                            cmnService.J_UserMessage(J_Msg.DuplicateCode);
                            txtPartyName.Select();
                            return(false);
                        }
                    }

                    return(true);
                }
            }
            catch (Exception err_handler)
            {
                cmnService.J_UserMessage(err_handler.Message);
                return(false);
            }
        }
Пример #8
0
        private void BtnEdit_Click(object sender, System.EventArgs e)
        {
            try
            {
                if (ViewGrid.CurrentRowIndex >= 0)
                {
                    ControlVisible(true);
                    ClearControls();

                    //=============== EDIT RESTRICTION ==================

                    // RESTRICT RECORD MODIFICATION WHEN START NO & LAST NO NOT MATCH
                    if (dmlService.J_IsRecordExist("MST_INVOICE_SERIES",
                                                   "    START_NO           <> LAST_NO " +
                                                   "AND INVOICE_SERIES_ID  = " + lngSearchId + "") == true)
                    {
                        cmnService.J_UserMessage("Modification not possible");

                        dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "INVOICE_SERIES_ID", lngSearchId);
                        return;
                    }

                    // RESTRICT RECORD MODIFICATION WHEN IF TRANSACTION IS OVER
                    if (dmlService.J_IsRecordExist("TRN_INVOICE_HEADER",
                                                   " INVOICE_SERIES_ID  = " + lngSearchId + "") == true)
                    {
                        cmnService.J_UserMessage("Modification not possible");
                        dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "INVOICE_SERIES_ID", lngSearchId);
                        return;
                    }


                    // A particular id wise retrieving the data from database
                    if (ShowRecord(Convert.ToInt64(Convert.ToString(ViewGrid[ViewGrid.CurrentRowIndex, 0]))) == false)
                    {
                        ControlVisible(false);
                        if (dsetGridClone == null)
                        {
                            return;
                        }
                        dmlService.J_setGridPosition(ref this.ViewGrid, dsetGridClone, "INVOICE_SERIES_ID", lngSearchId);
                    }

                    lblMode.Text = J_Mode.Edit;
                    cmnService.J_StatusButton(this, lblMode.Text);
                    lblSearchMode.Text = J_Mode.General;

                    strCheckFields = "";
                }
                else
                {
                    cmnService.J_UserMessage(J_Msg.DataNotFound);
                    if (dsetGridClone == null)
                    {
                        return;
                    }
                    dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "INVOICE_SERIES_ID", lngSearchId);
                }
            }
            catch (Exception err_handler)
            {
                ControlVisible(false);
                cmnService.J_UserMessage(err_handler.Message);
            }
        }
Пример #9
0
        private void BtnSave_Click(object sender, EventArgs e)
        {
            // Added by Ripan Paul on 23-07-2011
            if (dmlService.J_IsRecordExist("MST_PARTY",
                                           "    BRANCH_ID  =  " + J_Var.J_pBranchId + " " +
                                           "AND PARTY_NAME = '" + cmnService.J_ReplaceQuote(txtPartyName.Text.Trim().ToUpper()) + "'") == true)
            {
                cmnService.J_UserMessage("Duplicate Party found ...");
                txtPartyName.Select();
                return;
            }

            // Save Confirmation Message
            if (cmnService.J_SaveConfirmationMessage(ref txtAddress1) == true)
            {
                return;
            }

            // Transaction is started
            dmlService.J_BeginTransaction();

            // insert query & execution
            strSQL = "INSERT INTO MST_PARTY (" +
                     "            BRANCH_ID," +
                     "            PARTY_CATEGORY_ID," +
                     "            PARTY_NAME," +
                     "            ADDRESS1," +
                     "            ADDRESS2," +
                     "            ADDRESS3," +
                     "            CITY," +
                     "            PIN," +
                     "            CONTACT_PERSON," +
                     "            MOBILE_NO," +
                     "            PHONE_NO," +
                     "            FAX," +
                     "            EMAIL_ID," +
                     "            USER_ID," +
                     "            CREATE_DATE) " +
                     "    VALUES( " + J_Var.J_pBranchId + "," +
                     "            " + Support.GetItemData(cmbPartyCategory, cmbPartyCategory.SelectedIndex) + ", " +
                     "           '" + cmnService.J_ReplaceQuote(txtPartyName.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtAddress1.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtAddress2.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtAddress3.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtCity.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtPin.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtContactPersonName.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtMobileNo.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtPhone.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtFaxNo.Text.Trim()) + "'," +
                     "           '" + cmnService.J_ReplaceQuote(txtEmailID.Text.Trim()) + "'," +
                     "            " + J_Var.J_pUserId + "," +
                     "            " + cmnService.J_DateOperator() + dtService.J_ConvertMMddyyyy(dmlService.J_ReturnServerDate()) + cmnService.J_DateOperator() + ")";
            if (dmlService.J_ExecSql(strSQL) == false)
            {
                txtPartyName.Select();
                return;
            }

            // Transaction is commited
            dmlService.J_Commit();

            // Added by Ripan Paul on 23-07-2011
            BS.BS_PartyName = txtPartyName.Text.Trim();

            // after data is inserted, the message is displayed
            cmnService.J_PanelMessage(J_PanelIndex.e00_DisplayText, J_Msg.AddModeSave);

            // exit from this form
            BtnExit_Click(sender, e);
        }
Пример #10
0
        static void Main()
        {
            // set the application name
            J_Var.J_pApplicationName = "BS v1.0";

            // set the project name
            J_Var.J_pProjectName = "Billing System";

            //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            // start block
            // set some parameters
            //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

            // set the Zip password
            J_Var.J_pZipFilePassword = "******";

            // set the Login Screen come or not
            //J_Var.J_pLoginScreen = J_LoginScreen.NO;

            #region FOR MOCROSOFT ACCESS DATABASE

            // =========================================
            // FOR MOCROSOFT ACCESS DATABASE
            // =========================================

            J_Var.J_pMsAccessDatabaseName     = "BillingSystem.mdb";
            J_Var.J_pMsAccessDatabasePassword = "";

            J_Var.J_pApplicationType        = J_ApplicationType.StandAlone_Network;
            J_Var.J_pDatabaseType           = J_DatabaseType.SqlServer;
            J_Var.J_pConnectionProviderType = J_ConnectionProviderType.Sql;

            // =========================================
            // =========================================

            #endregion

            #region FOR MOCROSOFT SQL SERVER DATABASE

            // =========================================
            // FOR MOCROSOFT SQL SERVER DATABASE
            // =========================================

            //J_Var.J_pApplicationType = J_ApplicationType.StandAlone_Network;
            //J_Var.J_pDatabaseType = J_DatabaseType.SqlServer;
            //J_Var.J_pConnectionProviderType = J_ConnectionProviderType.Sql;

            // =========================================
            // =========================================

            #endregion

            // set the xml file name as connection to database
            J_Var.J_pXmlConnectionFileName = "_JS_BS.xml";

            // set the xml file name as Branch Information
            J_Var.J_pXmlBranchInfoFileName = "_JS_BS_B.xml";

            // set the command time-out
            J_Var.J_pCommandTimeout = 99999;

            //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
            // end block
            //@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

            // declare & initialization objects
            DMLService    dmlService = new DMLService();
            CommonService cmnService = new CommonService();
            DateService   dtService  = new DateService();

            // set the Operating Syatem type [32 bit | 64 bit]
            J_Var.J_pOSType = cmnService.J_GetOSType();

            // declare & initialization variable
            string strSQL = string.Empty;

            // To Check the DateTime Format
            if (dtService.J_SystemDateFormatCheck_dd_MM_yyyy() == false)
            {
                return;
            }

            // to check the application type as StandAlone & SingleMachine
            if (J_Var.J_pApplicationType == J_ApplicationType.StandAlone_SingleMachine)
            {
                // to check the microsoft database file is exist or not
                if (cmnService.J_IsFileExist(Application.StartupPath + "/" + J_Var.J_pMsAccessDatabaseName) == false)
                {
                    dmlService.Dispose();
                    cmnService.J_UserMessage("Database file does not exist.\nPlease check the database file");
                    return;
                }

                // to check the connection is possible or not
                if (dmlService.J_ValidateConnection() == false)
                {
                    dmlService.Dispose();
                    cmnService.J_UserMessage("Invalid database.\nPlease check the database");
                    return;
                }

                // to check the MST_FAYEAR table is exist or not
                if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == false)
                {
                    dmlService.Dispose();
                    cmnService.J_UserMessage("Invalid database structure.\nPlease check the database");
                    return;
                }

                // declare & initialize the hashtable object to create the xml file
                Hashtable nameValue = new Hashtable();

                // store values to hashtable
                nameValue.Add("SERVERNAME", "");
                nameValue.Add("DATABASENAME", Application.StartupPath);
                nameValue.Add("USERNAME", J_Var.J_pMsAccessDatabaseName);
                nameValue.Add("PASSWORD", J_Var.J_pMsAccessDatabasePassword);

                // declare & initialize the object of XMLService
                XMLService objxml = new XMLService();

                // create the xml file to connect to the database
                objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName);

                if (dmlService.J_IsRecordExist("MST_FAYEAR") == true)
                {
                    dmlService.Dispose();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    if (J_Var.J_pLoginScreen == J_LoginScreen.YES)
                    {
                        CmnLogin frm = new CmnLogin();
                        frm.ShowDialog();
                        frm.Dispose();
                    }
                    else if (J_Var.J_pLoginScreen == J_LoginScreen.NO)
                    {
                        J_Var.frmMain = new mdiBillingSystem();
                        J_Var.frmMain.ShowDialog();
                    }
                }
                else
                {
                    dmlService.Dispose();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    CmnCreate1stFAYear frm = new CmnCreate1stFAYear();
                    frm.ShowDialog();
                    frm.Dispose();
                }
                return;
            }

            // to check the application type as StandAlone, SingleMachine & Browser to Config window
            if (J_Var.J_pApplicationType == J_ApplicationType.StandAlone_SingleMachineBrowser)
            {
                // to check the microsoft xml file is exist or not
                if (cmnService.J_IsFileExist(Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName) == false)
                {
                    dmlService.Dispose();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    SysServerInfoLocalBrowser frmLocalBrowser = new SysServerInfoLocalBrowser();
                    frmLocalBrowser.ShowDialog();
                    frmLocalBrowser.Dispose();
                    return;
                }

                DataSet dsUserInfo = dmlService.J_ConvertXmlToDataSet(Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName);
                if (dsUserInfo == null)
                {
                    return;
                }
                J_Var.J_pDatabaseName = cmnService.J_Decode(dsUserInfo.Tables[0].Rows[0][cmnService.J_Encode("DATABASENAME")].ToString());

                // to check the microsoft database file is exist or not
                if (cmnService.J_IsFileExist(J_Var.J_pDatabaseName + "/" + J_Var.J_pMsAccessDatabaseName) == false)
                {
                    dmlService.Dispose();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    SysServerInfoLocalBrowser frmLocalBrowser = new SysServerInfoLocalBrowser();
                    frmLocalBrowser.ShowDialog();
                    frmLocalBrowser.Dispose();
                    return;
                }

                // to check the connection is possible or not
                if (dmlService.J_ValidateConnection() == false)
                {
                    dmlService.Dispose();
                    cmnService.J_UserMessage("Invalid database.\nPlease check the database");
                    return;
                }

                // to check the MST_FAYEAR table is exist or not
                if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == false)
                {
                    dmlService.Dispose();
                    cmnService.J_UserMessage("Invalid database structure.\nPlease check the database");
                    return;
                }

                // check atleast one fayear data exist or not.
                if (dmlService.J_IsRecordExist("MST_FAYEAR") == true)
                {
                    dmlService.Dispose();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);

                    if (J_Var.J_pLoginScreen == J_LoginScreen.YES)
                    {
                        CmnLogin frm = new CmnLogin();
                        frm.ShowDialog();
                        frm.Dispose();
                    }
                    else if (J_Var.J_pLoginScreen == J_LoginScreen.NO)
                    {
                        J_Var.frmMain = new mdiBillingSystem();
                        J_Var.frmMain.ShowDialog();
                    }
                }
                else
                {
                    dmlService.Dispose();

                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    CmnCreate1stFAYear frm = new CmnCreate1stFAYear();
                    frm.ShowDialog();
                    frm.Dispose();
                }
                return;
            }

            // to check the microsoft xml file is exist or not
            if (cmnService.J_IsFileExist(Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName) == true)
            {
                if (dmlService.J_ValidateConnection() == true)
                {
                    // check the MST_FAYEAR table exist or not
                    if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == true)
                    {
                        if (dmlService.J_IsRecordExist("MST_FAYEAR") == true)
                        {
                            dmlService.Dispose();

                            Application.EnableVisualStyles();
                            Application.SetCompatibleTextRenderingDefault(false);
                            CmnLogin frm = new CmnLogin();
                            frm.ShowDialog();
                            frm.Dispose();
                        }
                        else
                        {
                            dmlService.Dispose();

                            Application.EnableVisualStyles();
                            Application.SetCompatibleTextRenderingDefault(false);
                            CmnCreate1stFAYear frm = new CmnCreate1stFAYear();
                            frm.ShowDialog();
                            frm.Dispose();
                        }
                        return;
                    }
                }
            }

            dmlService.Dispose();

            if (J_Var.J_pDatabaseType == J_DatabaseType.MsAccess)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                SysServerInfoLocal frmLocal = new SysServerInfoLocal();
                frmLocal.ShowDialog();
                frmLocal.Dispose();
            }
            else if (J_Var.J_pDatabaseType == J_DatabaseType.SqlServer)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                SysServerInfoNetwork frmNetwork = new SysServerInfoNetwork();
                frmNetwork.ShowDialog();
                frmNetwork.Dispose();
            }
            return;
        }
Пример #11
0
        private bool ValidateFields()
        {
            try
            {
                if (lblSearchMode.Text == J_Mode.Sorting)
                {
                    if (Convert.ToInt64(Convert.ToString(ViewGrid.CurrentRowIndex)) < 0)
                    {
                        cmnService.J_UserMessage(J_Msg.DataNotFound);
                        if (dsetGridClone == null)
                        {
                            return(false);
                        }
                        dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "TAX_ID", lngSearchId);
                        return(false);
                    }
                    return(true);
                }
                else if (lblSearchMode.Text == J_Mode.Searching)
                {
                    if (grpSearch.Visible == false)
                    {
                        if (Convert.ToInt64(Convert.ToString(ViewGrid.CurrentRowIndex)) < 0)
                        {
                            cmnService.J_UserMessage(J_Msg.DataNotFound);
                            if (dsetGridClone == null)
                            {
                                return(false);
                            }
                            dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "TAX_ID", lngSearchId);
                            return(false);
                        }
                    }
                    else if (grpSearch.Visible == true)
                    {
                        if (txtTaxDescSearch.Text.Trim() == "")
                        {
                            cmnService.J_UserMessage(J_Msg.SearchingValues);
                            txtTaxDescSearch.Select();
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                {
                    // Tax Description
                    if (txtTaxDesc.Text.Trim() == "")
                    {
                        cmnService.J_UserMessage("Please enter tax description");
                        txtTaxDesc.Select();
                        return(false);
                    }

                    // Duplicacy check with repect to the tax description
                    if (lblMode.Text == J_Mode.Add)
                    {
                        if (dmlService.J_IsRecordExist("MST_TAX",
                                                       "    TAX_DESC  = '" + cmnService.J_ReplaceQuote(txtTaxDesc.Text) + "' " +
                                                       "AND BRANCH_ID =  " + J_Var.J_pBranchId + " ") == true)
                        {
                            cmnService.J_UserMessage(J_Msg.DuplicateName);
                            txtTaxDesc.Select();
                            return(false);
                        }
                    }
                    else if (lblMode.Text == J_Mode.Edit)
                    {
                        //  Duplicacy check with respect to district id
                        if (dmlService.J_IsRecordExist("MST_TAX",
                                                       "    TAX_DESC  = '" + cmnService.J_ReplaceQuote(txtTaxDesc.Text) + "' " +
                                                       "AND BRANCH_ID =  " + J_Var.J_pBranchId + " " +
                                                       "AND TAX_ID    <> " + lngSearchId) == true)
                        {
                            cmnService.J_UserMessage(J_Msg.DuplicateName);
                            txtTaxDesc.Select();
                            return(false);
                        }
                    }

                    // Tax Percentage
                    if (cmnService.J_ReturnDoubleValue(txtTaxPercentage.Text.Trim()) == 0)
                    {
                        cmnService.J_UserMessage("Please enter tax percentage");
                        txtTaxPercentage.Select();
                        return(false);
                    }
                    return(true);
                }
            }
            catch (Exception err_handler)
            {
                cmnService.J_UserMessage(err_handler.Message);
                return(false);
            }
        }
Пример #12
0
        private bool ValidateFields()
        {
            try
            {
                if (lblSearchMode.Text == J_Mode.Sorting)
                {
                    if (Convert.ToInt64((ViewGrid.CurrentRowIndex).ToString()) < 0)
                    {
                        cmnService.J_UserMessage(J_Msg.DataNotFound);
                        if (dsetGridClone == null)
                        {
                            return(false);
                        }
                        dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "USER_ID", lngSearchId);
                        return(false);
                    }
                    return(true);
                }
                else if (lblSearchMode.Text == J_Mode.Searching)
                {
                    if (grpSearch.Visible == false)
                    {
                        if (Convert.ToInt64(ViewGrid.CurrentRowIndex.ToString()) < 0)
                        {
                            cmnService.J_UserMessage(J_Msg.DataNotFound);
                            if (dsetGridClone == null)
                            {
                                return(false);
                            }
                            dmlService.J_setGridPosition(ref ViewGrid, dsetGridClone, "USER_ID", lngSearchId);
                            return(false);
                        }
                    }
                    else if (grpSearch.Visible == true)
                    {
                        if (txtUserNameSearch.Text.Trim() == "")
                        {
                            cmnService.J_UserMessage("Please enter the user name to search.");
                            txtUserNameSearch.Select();
                            return(false);
                        }
                    }
                    return(true);
                }
                else
                {
                    if (txtUserName.Text.Trim() == "")
                    {
                        cmnService.J_UserMessage("Please enter the user name.");
                        txtUserName.Select();
                        return(false);
                    }

                    if (txtLoginId.Text.Trim() == "")
                    {
                        cmnService.J_UserMessage("Please enter the login id.");
                        txtLoginId.Select();
                        return(false);
                    }

                    if ((lblMode.Text == J_Mode.Add) || (lblMode.Text == J_Mode.Edit && chkResetPassword.Checked == true))
                    {
                        if (txtPassword.Text == "")
                        {
                            cmnService.J_UserMessage("Please enter the password.");
                            txtPassword.Select();
                            return(false);
                        }

                        if (txtPassword2.Text == "")
                        {
                            cmnService.J_UserMessage("Please enter the password.");
                            txtPassword2.Select();
                            return(false);
                        }

                        if (txtPassword.Text != txtPassword2.Text)
                        {
                            cmnService.J_UserMessage("Entered passwords do not match.");
                            txtPassword.Select();
                            return(false);
                        }
                    }

                    // Duplicacy check with respect to the mode of other validations
                    if (lblMode.Text == J_Mode.Add)
                    {
                        // Duplicate check for LOGIN ID ONLY
                        if (dmlService.J_IsRecordExist("MST_USER",
                                                       "    BRANCH_ID = " + J_Var.J_pBranchId + " " +
                                                       "AND " + cmnService.J_SQLDBFormat("LOGIN_ID", J_SQLColFormat.UCase) + " = '" + txtLoginId.Text.ToUpper() + "'") == true)
                        {
                            cmnService.J_UserMessage("Login id already exist.");
                            txtLoginId.Select();
                            return(false);
                        }

                        // Check active/inactive
                        if (chkActiveInactive.Checked == false)
                        {
                            cmnService.J_UserMessage("New user should be active.");
                            chkActiveInactive.Select();
                            return(false);
                        }
                    }
                    return(true);
                }
            }
            catch (Exception err_handler)
            {
                cmnService.J_UserMessage(err_handler.Message);
                return(false);
            }
        }
Пример #13
0
        private void BtnSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                // all validations
                if (ValidateFields() == false)
                {
                    return;
                }

                string strDatabasePath = cmnService.J_GetDirectoryName(txtBrowser.Text);

                // create the connection xml file
                Hashtable nameValue = new Hashtable();
                nameValue.Add("SERVERNAME", "");
                nameValue.Add("DATABASENAME", strDatabasePath);
                nameValue.Add("USERNAME", J_Var.J_pMsAccessDatabaseName);
                nameValue.Add("PASSWORD", J_Var.J_pMsAccessDatabasePassword);

                XMLService objxml = new XMLService();
                objxml.J_CreateXMLFile(nameValue, Application.StartupPath + "/" + J_Var.J_pXmlConnectionFileName);

                if (dmlService.J_IsDatabaseObjectExist("MST_FAYEAR") == true)
                {
                    // Close & Dispose the MstLogin Class
                    this.Close();
                    this.Dispose();

                    // Close & Dispose the main Class
                    if (J_Var.J_pLoginStatus == 1)
                    {
                        J_Var.frmMain.Close();
                        J_Var.frmMain.Dispose();
                    }

                    if (dmlService.J_IsRecordExist("MST_FAYEAR") == true)
                    {
                        dmlService.Dispose();

                        if (J_Var.J_pLoginScreen == J_LoginScreen.YES)
                        {
                            CmnLogin frm = new CmnLogin();
                            frm.ShowDialog();
                            frm.Dispose();
                        }
                        else if (J_Var.J_pLoginScreen == J_LoginScreen.NO)
                        {
                            J_Var.frmMain = new mdiBillingSystem();
                            J_Var.frmMain.ShowDialog();
                        }
                    }
                    else
                    {
                        dmlService.Dispose();

                        CmnCreate1stFAYear frm = new CmnCreate1stFAYear();
                        frm.ShowDialog();
                        frm.Dispose();
                    }
                    return;
                }
                else
                {
                    dmlService.Dispose();
                    cmnService.J_UserMessage("Invalid database structure.\nPlease check the database");
                    BtnBrowser.Focus();
                    return;
                }
            }
            catch (Exception err_handler)
            {
                dmlService.Dispose();
                cmnService.J_UserMessage(err_handler.Message);
            }
        }