Exemple #1
0
            protected void OpenConnection()
            {
                m_oDalConfig = ConfigManager.GetConfig<CDalConfig>();

                if (m_oDalConfig != null)
                {
                    OpenConnection(m_oDalConfig.ConnectionString);
                }
                else
                {
                    throw new DAOException("Error occured while oppening database connection: DalConfig object was null.");
                }
            }
Exemple #2
0
        public CResult ProcessAdminLogin(CUserInfo inUserInfo)
        {
            CResult oNewResult = new CResult();

            try
            {

                CUserManager oManager = new CUserManager();

                CResult oResult = oManager.LoginAdminUser(inUserInfo);

                if (oResult.IsSuccess && oResult.Data != null)
                {

                    CUserInfo oUser = (CUserInfo)oResult.Data;

                    CResult oResult2 = oManager.GetUserAccess(oUser);

                    if (oResult2.IsSuccess && oResult2.Data != null)
                    {

                        CUserAccess oUserAccess = (CUserAccess)oResult2.Data;

                        oUser.UserAccess = oUserAccess;

                        CUserLogin oUserLogin = new CUserLogin();

                        oUserLogin.UserInfo = oUser;

                        CDalConfig oTempDal = ConfigManager.GetConfig<CDalConfig>();

                        String tempConnStr = oTempDal.ConnectionString;

                        oUserLogin.ConnectionStr = tempConnStr;

                        oNewResult.Data = oUserLogin;

                        oNewResult.IsSuccess = true;

                    }

                }

            }
            catch (Exception ex)
            {
            }

            return oNewResult;
        }
Exemple #3
0
        private void FillFoodType(Int32 parentId)
        {
            if (cmbParent.SelectedIndex < 0)
            {
                return;
            }
            String sqlCommand = "";

            if (parentId == 0)
            {
                sqlCommand = SqlQueries.GetQuery(Query.ViewAllFoodType);
            }
            else
            {
                sqlCommand = String.Format(SqlQueries.GetQuery(Query.ViewCat1ComboBox), parentId);
            }

            CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

            String tempConnStr = oTempDal.ConnectionString;

            SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

            // Create a command builder to generate SQL update, insert, and
            // delete commands based on selectCommand. These are used to
            // update the database.
            SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

            // Populate a new data table and bind it to the BindingSource.
            DataTable table = new DataTable();

            table.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataAdapter.Fill(table);
            if (table.Rows.Count > 0)
            {
                table.Rows.Add(new object[] { "0", "All" });
                cmbFoodType.DataSource = table;
                cmbFoodType.Text       = "All";
            }
            else
            {
                cmbFoodType.DataSource    = table;
                cmbFoodType.SelectedIndex = -1;
                FillFoodCategory();
            }

            dataAdapter.Dispose();
        }
Exemple #4
0
        private void FillCategory1ByID(int parentCategoryID)
        {
            if (cmbParent.SelectedIndex < 0)
            {
                return;
            }
            else
            {
                if (cmbParent.SelectedValue != null)
                {
                    //int iTempInt = Int32.Parse(cmbParentCategory.SelectedValue.ToString());

                    String sqlCommand = String.Empty;

                    if (cmbParent.SelectedValue.ToString() == "0")
                    {
                        sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1);
                    }
                    else
                    {
                        sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1ByParentCat);
                    }

                    sqlCommand = String.Format(sqlCommand, parentCategoryID);

                    CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                    String tempConnStr = oTempDal.ConnectionString;

                    // Create a new data adapter based on the specified query.
                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

                    // Create a command builder to generate SQL update, insert, and
                    // delete commands based on selectCommand. These are used to
                    // update the database.
                    SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                    // Populate a new data table and bind it to the BindingSource.
                    DataTable table = new DataTable();
                    table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                    dataAdapter.Fill(table);
                    //table.Rows.Add(new object[]{"0","All","",0,"",""});
                    cmbFoodType.DataSource = table;

                    dataAdapter.Dispose();
                }
            }
        }
Exemple #5
0
        private void ProcessLogin()
        {
            try
            {
                CCommonConstants objCommonConstant = ConfigManager.GetConfig <CCommonConstants>();

                CDalConfig objDalConstant = ConfigManager.GetConfig <CDalConfig>();

                CUserManager tempUserManager = new CUserManager();
                CLogin       objLogin        = new CLogin();
                CUserInfo    objUserInfo     = new CUserInfo();

                //objUserInfo.UserName = UserLabel.Text.Trim();

                //objUserInfo.Password = LoginTextBox.Text.Trim();


                objLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), objCommonConstant.RemoteURL);

                CResult objResult = objLogin.ProcessAdminLogin(objUserInfo);

                if (objResult.IsSuccess && objResult.Data != null)
                {
                    CUserLogin objUserLogin = (CUserLogin)objResult.Data;

                    objCommonConstant.UserInfo = objUserLogin.UserInfo;

                    objDalConstant.ConnectionString = objUserLogin.ConnectionStr;
                    RMSGlobal.LogInUserName         = objCommonConstant.UserInfo.UserName;

                    objCommonConstant.DBConnection = objUserLogin.ConnectionStr;

                    RMSAdminMdiForm objParent = new RMSAdminMdiForm();  //Previous
                    objParent.Show();
                    this.Hide();
                }
                else
                {
                    //g_ErrorLabel.Show();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message, RMSGlobal.MessageBoxTitle,
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #6
0
        private void CollectFoodType()
        {
            String sqlCommand = String.Empty;

            sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1);

            CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

            String tempConnStr = oTempDal.ConnectionString;

            // Create a new data adapter based on the specified query.
            SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

            SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

            DataTable table = new DataTable();

            table.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataAdapter.Fill(table);

            rptFoodType objFoodType = new rptFoodType();

            objFoodType.SetDataSource(table);
            string reportHeader = RMSAdminController.CollectHeader();
            string reportFooter = RMSAdminController.CollectFooter();

            objFoodType.SetParameterValue(0, reportHeader);
            objFoodType.SetParameterValue(1, reportFooter);


            dataAdapter.Dispose();



            RecportViewerCtl objRptViewer = new RecportViewerCtl(this);

            objRptViewer.cRptViewerAdmin.ReportSource = objFoodType;


            pnlContext.Controls.Clear();

            objRptViewer.Parent = this;
            pnlContext.Controls.Add(objRptViewer);
            objRptViewer.Dock = DockStyle.Fill;
        }
Exemple #7
0
        private void showreportButton_Click(object sender, EventArgs e)
        {
            try
            {
                String sqlCommand = "";
                if (employeecheckBox.Checked)
                {
                    sqlCommand = string.Format(SqlQueries.GetQuery(Query.ViewEmployeeSalaryReportWithEmployee), yearcomboBox.Text, monthcomboBox.Text, Convert.ToInt32(employeecomboBox.SelectedValue));
                }
                else
                {
                    sqlCommand = string.Format(SqlQueries.GetQuery(Query.ViewEmployeeSalaryReport), yearcomboBox.Text, monthcomboBox.Text);
                }



                //sqlCommand = String.Format(sqlCommand, categoryID);



                CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                String tempConnStr = oTempDal.ConnectionString;

                // Create a new data adapter based on the specified query.
                SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

                // Create a command builder to generate SQL update, insert, and
                // delete commands based on selectCommand. These are used to
                // update the database.
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                // Populate a new data table and bind it to the BindingSource.
                DataTable table = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                dataAdapter.Fill(table);
                employeereportdataGridView.DataSource = table;

                dataAdapter.Dispose();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #8
0
        private void FillCategory1ByID(int parentCategoryID)
        {
            if (cmbParentCategory.SelectedIndex < 0)
            {
                return;
            }
            else
            {
                if (cmbParentCategory.SelectedValue != null)
                {
                    //int iTempInt = Int32.Parse(cmbParentCategory.SelectedValue.ToString());

                    String sqlCommand = String.Empty;

                    if (cmbParentCategory.SelectedValue.ToString() == "0")
                    {
                        sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1);
                    }
                    else
                    {
                        sqlCommand = SqlQueries.GetQuery(Query.ViewCategory1ByParentCat);
                    }

                    sqlCommand = String.Format(sqlCommand, parentCategoryID);

                    CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                    String tempConnStr = oTempDal.ConnectionString;

                    // Create a new data adapter based on the specified query.
                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

                    SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                    // Populate a new data table and bind it to the BindingSource.
                    DataTable table = new DataTable();
                    table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                    dataAdapter.Fill(table);

                    dgvFoodTypeList.DataSource = table;

                    dataAdapter.Dispose();
                }
            }
        }
Exemple #9
0
        private static void Init()
        {
            ConfigManager.Init();
            ConfigManager.ReloadConfig();
            CCommonConstants oTempConstant = ConfigManager.GetConfig <CCommonConstants>();

            CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

            CLogin oLogin = new CLogin();

            oLogin = (RmsRemote.CLogin)Activator.GetObject(typeof(RmsRemote.CLogin), oTempConstant.RemoteURL);

            CResult oResult = oLogin.GetInitialDBStr();

            if (oResult.IsSuccess && oResult.Data != null)
            {
                DataSet dsRecords = new DataSet();
                String  oTempStr  = (String)oResult.Data;
                oTempConstant.DBConnection         = oTempStr;
                RMSGlobal.m_serverConnectionString = oTempConstant.DBConnection;

                CReportManager objReportMgnr = new CReportManager();
                CResult        objFoodType   = objReportMgnr.GetFoodTypesRecords();
                dsRecords         = (DataSet)objFoodType.Data;
                m_foodTypeRecords = dsRecords.Tables[0];

                objFoodType       = objReportMgnr.GetFoodCategoryRecords();
                dsRecords         = (DataSet)objFoodType.Data;
                m_categoryRecords = dsRecords.Tables[0];

                objFoodType       = objReportMgnr.GetFoodItemRecords();
                dsRecords         = (DataSet)objFoodType.Data;
                m_foodItemRecords = dsRecords.Tables[0];

                objFoodType            = objReportMgnr.GetSelectionofItemsRecords();
                dsRecords              = (DataSet)objFoodType.Data;
                m_selectionItemRecords = dsRecords.Tables[0];

                //m_initDataSet.Relations.Add("category1_to_category2",
                //      m_foodTypeRecords.Columns["cat1_id"],
                //      m_categoryRecords.Columns["cat1_id"], false);
            }
        }
Exemple #10
0
        private void FillCategory(Int32 foodTypeID)
        {
            try
            {
                if (cmbFoodType.SelectedIndex < 0)
                {
                    return;
                }


                String queryStr = SqlQueries.GetQuery(Query.ViewCategory2ByCat1ComboBox);

                queryStr = String.Format(queryStr, foodTypeID);

                CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                String tempConnStr = oTempDal.ConnectionString;

                SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr);

                // Create a command builder to generate SQL update, insert, and
                // delete commands based on selectCommand. These are used to
                // update the database.
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                // Populate a new data table and bind it to the BindingSource.
                DataTable table = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                dataAdapter.Fill(table);

                //cmbCategory.DisplayMember = "cat2_name";

                //cmbCategory.ValueMember = "cat2_id";

                cmbCategory.DataSource = table;
                dataAdapter.Dispose();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.",
                                RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #11
0
        public CResult GetInitialDBStr()
        {
            CResult oResult = new CResult();

            try
            {
                CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                String sTempDB = oTempDal.ConnectionString;

                oResult.Data = sTempDB;

                oResult.IsSuccess = true;
            }
            catch (Exception ex)
            {
            }

            return(oResult);
        }
Exemple #12
0
        private void FillReceiptStyle()
        {
            String sqlCommand = SqlQueries.GetQuery(Query.GetAllPrintStyle);

            CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

            String tempConnStr = oTempDal.ConnectionString;

            // Create a new data adapter based on the specified query.
            SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

            SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

            // Populate a new data table and bind it to the BindingSource.
            DataTable table = new DataTable();

            table.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataAdapter.Fill(table);
            dgvReceiptStyles.DataSource = table;
        }
Exemple #13
0
        private void FillFoodItem(Int32 categoryID)
        {
            try
            {
                if (cmbCategory.SelectedIndex < 0)
                {
                    return;
                }
                else
                {
                    String sqlCommand = SqlQueries.GetQuery(Query.ViewCategory3ByCat2ComboBox);

                    sqlCommand = String.Format(sqlCommand, categoryID);

                    CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                    String tempConnStr = oTempDal.ConnectionString;

                    // Create a new data adapter based on the specified query.
                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

                    // Create a command builder to generate SQL update, insert, and
                    // delete commands based on selectCommand. These are used to
                    // update the database.
                    SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                    // Populate a new data table and bind it to the BindingSource.
                    DataTable table = new DataTable();
                    table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                    dataAdapter.Fill(table);
                    cmbFoodItem.DataSource = table;
                    cmbFoodItem.Text       = m_sFoodItemText;

                    dataAdapter.Dispose();
                }
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.", RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #14
0
        private void LoadParentCategory()
        {
            try
            {
                String queryStr = SqlQueries.GetQuery(Query.ViewParentCategory);

                CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                String tempConnStr = oTempDal.ConnectionString;

                // Create a new data adapter based on the specified query.
                SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr);

                // Create a command builder to generate SQL update, insert, and
                // delete commands based on selectCommand. These are used to
                // update the database.
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                // Populate a new data table and bind it to the BindingSource.
                DataTable table = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                dataAdapter.Fill(table);
                //bindingSource1.DataSource = table;

                dgvParentCategory.DataSource = table;
                // dgvParentCategory.Columns["Parent_Category_Name"].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill;

                table.TableName = "parent_category";
                table.WriteXml("parent_category.xml", XmlWriteMode.IgnoreSchema);

                dataAdapter.Dispose();

                //this.dgvParentCategory.Columns["parent_cat_id"].Visible = false;
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message + ". Error Occured. Please contact to your administrator.");
            }
        }
Exemple #15
0
        private void FillUsers()
        {
            try
            {
                String queryStr = SqlQueries.GetQuery(Query.ViewUserInfo);

                CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                String tempConnStr = oTempDal.ConnectionString;

                //create an OleDbDataAdapter to execute the query
                //OleDbDataAdapter dAdapter =
                //   new OleDbDataAdapter(query, connString);

                // Create a new data adapter based on the specified query.
                SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr);

                // Create a command builder to generate SQL update, insert, and
                // delete commands based on selectCommand. These are used to
                // update the database.
                SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                // Populate a new data table and bind it to the BindingSource.
                DataTable table = new DataTable();
                table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                dataAdapter.Fill(table);
                //bindingSource1.DataSource = table;

                dgvUsers.DataSource = table;

                dataAdapter.Dispose();
            }
            catch (Exception exp)
            {
                MessageBox.Show(exp.Message + "Error Occured. Please contact to your administrator.",
                                RMSGlobal.MessageBoxTitle, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #16
0
        private void FillFoodCategory(Int32 foodTypeID)
        {
            if (cmbFoodType.SelectedIndex < 0)
            {
                return;
            }
            else
            {
                if (cmbFoodType.SelectedValue != null)
                {
                    String sqlCommand = SqlQueries.GetQuery(Query.ViewCategory2ByCat1);

                    sqlCommand = String.Format(sqlCommand, foodTypeID);

                    CDalConfig oTempDal = ConfigManager.GetConfig <CDalConfig>();

                    String tempConnStr = oTempDal.ConnectionString;


                    // Create a new data adapter based on the specified query.
                    SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlCommand, tempConnStr);

                    // Create a command builder to generate SQL update, insert, and
                    // delete commands based on selectCommand. These are used to
                    // update the database.
                    SqlCommandBuilder commandBuilder = new SqlCommandBuilder(dataAdapter);

                    // Populate a new data table and bind it to the BindingSource.
                    DataTable table = new DataTable();
                    table.Locale = System.Globalization.CultureInfo.InvariantCulture;
                    dataAdapter.Fill(table);
                    cmbCategory.DataSource = table;
                    cmbCategory.Text       = m_sCategoryText;
                    dataAdapter.Dispose();
                }
            }
        }
Exemple #17
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            //To Get parent catagory Order Number


            String     queryStr    = SqlQueries.GetQuery(Query.GetMaxParentCategoryNumber);
            CDalConfig oTempDal    = ConfigManager.GetConfig <CDalConfig>();
            String     tempConnStr = oTempDal.ConnectionString;
            // Create a new data adapter based on the specified query.
            SqlDataAdapter dataAdapter = new SqlDataAdapter(queryStr, tempConnStr);
            // Populate a new data table and bind it to the BindingSource.
            DataTable table = new DataTable();

            //table.Locale = System.Globalization.CultureInfo.InvariantCulture;
            dataAdapter.Fill(table);

            int lastMaxParentValue = Convert.ToInt32(table.Rows[0]["Column1"].ToString());

            CResult oValidResult = ValidateForm();

            if (oValidResult.IsSuccess)
            {
                String sTempStr = txtParentCategoryName.Text.Trim();

                if (sTempStr.Equals(String.Empty))
                {
                    lblSaveStatus.Text = " Write the name of the category.";

                    lblSaveStatus.Visible = true;
                }
                else
                {
                    CParentCategory oTempParent = new CParentCategory();

                    oTempParent.ParentCatName = sTempStr;
                    oTempParent.ParentCatID   = lastMaxParentValue + 1;

                    CCategoryManager oManager = new CCategoryManager();

                    CResult oResult = oManager.AddParentCat(oTempParent);

                    if (oResult.IsSuccess)
                    {
                        lblSaveStatus.Text = " Parent category has been added successfully.";

                        lblSaveStatus.Visible = true;
                    }
                    else
                    {
                        lblSaveStatus.Text = oResult.Message;

                        lblSaveStatus.Visible = true;
                    }
                }
            }
            else
            {
                lblSaveStatus.Text = oValidResult.Message;

                lblSaveStatus.Visible = true;
            }
        }