コード例 #1
0
ファイル: frmPromotionLookup.cs プロジェクト: maverick126/RSM
        private void btnSearch_Click(object sender, EventArgs e)
        {
            int    published, promID;
            string promName;

            if (txtPromID.Text.ToString() != "")
            {
                promID = Int32.Parse(txtPromID.Text.ToString());
            }
            else
            {
                promID = 0;
            }
            promName = txtPromName.Text.ToString();
            if (chkActive.Checked)
            {
                published = 1;
            }
            else
            {
                published = 0;
            }

            this.promotionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();

            //when dataAdapter fill the dataset, query was written in PMO006STGDataSet.xsd file.
            this.promotionTableAdapter.FillBy(this.pMO006STGDataSet.promotion, promID, promName, published);
        }
コード例 #2
0
ファイル: frmLogin.cs プロジェクト: maverick126/RSM
        private void btnLogin_Click(object sender, EventArgs e)
        {
            this.Authenticated = true;
            if (radDev.Checked)
            {
                MetriconCommon.Environment = "DEV";
                SQSAdmin_WpfCustomControlLibrary.CommonVariables.Environment = "DEV";
            }
            else if (radTest.Checked)
            {
                MetriconCommon.Environment = "STG";
                SQSAdmin_WpfCustomControlLibrary.CommonVariables.Environment = "STG";
            }
            else
            {
                MetriconCommon.Environment = "LIVE";
                SQSAdmin_WpfCustomControlLibrary.CommonVariables.Environment = "LIVE";
            }

            MetriconCommon.State         = cmbState.SelectedValue.ToString();
            MetriconCommon.UserState     = cmbState.SelectedValue.ToString();
            MetriconCommon.UserStateName = cmbState.Text;

            MetriconCommon.WindowTitleInfo = "Logged in as " + MetriconCommon.UserName + " Using " + cmbState.Text + " " + MetriconCommon.Environment + " environment";


            SQSAdmin_WpfCustomControlLibrary.CommonVariables.UserCode        = ((DataRowView)comboBox1.SelectedItem)["AdministratorID"].ToString();
            SQSAdmin_WpfCustomControlLibrary.CommonVariables.WcfEndpoint     = MetriconCommon.getWcfEndpoint();
            SQSAdmin_WpfCustomControlLibrary.CommonVariables.WindowTitleInfo = MetriconCommon.WindowTitleInfo;
            this.Close();
        }
コード例 #3
0
ファイル: ServerManager.cs プロジェクト: maverick126/RSM
 public DataSet ExecuteSQLQuery(string sqlQuery)
 {
     try
     {
         mySQLConnection = new SqlConnection(this.sSQLConnectionString);
         mySQLAdapter    = new SqlDataAdapter(sqlQuery, mySQLConnection);
         myDataSet       = new DataSet();
         mySQLConnection.Open();
         mySQLAdapter.FillSchema(myDataSet, SchemaType.Source);
         mySQLAdapter.Fill(myDataSet);
     }
     catch (Exception e)
     {
         MetriconCommon.LogToFile("", "", "ServerManager.ExecuteSQLQuery", e.Message.ToString());
     }
     finally
     {
         //if there are no tables add default table
         if (myDataSet.Tables.Count == 0)
         {
             myDataSet.Tables.Add(new DataTable("NoRecords"));
         }
         mySQLConnection.Close();
         mySQLConnection.Dispose();
     }
     return(myDataSet);
 }
コード例 #4
0
ファイル: frmPrice.cs プロジェクト: maverick126/RSM
        private void ApplyCMA()
        {
            double dbcCost   = 0;
            double btpCost   = 0;
            double sellPrice = 0;
            double gst       = 1.1;

            double.TryParse(textBoxDBCCost.Text.ToString().Replace("$", ""), out dbcCost);
            if (checkBoxApplyCMA.Checked)
            {
                double cmaPercent = 0;
                double.TryParse(textBoxCMAPercent.Text.ToString(), out cmaPercent);

                btpCost = dbcCost + dbcCost * (cmaPercent / 100);
            }
            else
            {
                btpCost = dbcCost;
            }
            double.TryParse(txtSellPrice.Text.ToString().Replace("$", ""), out sellPrice);
            textBoxBTPCost.Text = btpCost.ToString();
            if (sellPrice > 0)
            {
                textBoxBTPTargetMargin.Text = Math.Round(100 * ((sellPrice / gst) - btpCost) / (sellPrice / gst), 2).ToString();
            }
            MetriconCommon.ToCurrency(ref textBoxBTPCost);
        }
コード例 #5
0
ファイル: ServerManager.cs プロジェクト: maverick126/RSM
    public bool LoadVariablesFromFile()
    {
        //loading from web.config file
        MetriconCommon.LogToFile("", "", "ServerManager.LoadVariablesFromFile", "");
        SetConnectionString();


        return(true);
    }
コード例 #6
0
ファイル: frmPromotionLookup.cs プロジェクト: maverick126/RSM
        private void frmPromotionLookup_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'pMO006STGDataSet.promotion' table. You can move, or remove it, as needed.
            this.Text = this.Text + " - " + MetriconCommon.WindowTitleInfo;
            this.promotionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();

            //when dataAdapter fill the dataset, query was written in PMO006STGDataSet.xsd file.
            this.promotionTableAdapter.Fill(this.pMO006STGDataSet.promotion);

            // classCustomizeScreenLookAndFeel.customizeMyScreen(this);
        }
コード例 #7
0
 public static void Configuration_Set()
 {
     try
     {
         // default #ccddff
         backColorSelected = ColorTranslator.FromHtml(MetriconCommon.GetSettings("BackColor").ToString());
     }
     catch (Exception ex)
     {
         // log error ex
     }
 }
コード例 #8
0
ファイル: frmMain.cs プロジェクト: maverick126/RSM
        private void buttonBackColorPicker_Click(object sender, EventArgs e)
        {
            // Show the color dialog.
            DialogResult result = colorDialog1.ShowDialog();

            // See if user pressed ok.
            if (result == DialogResult.OK)
            {
                // Set form background to the selected color.
                textBoxBackColorPicker.BackColor = colorDialog1.Color;
                classCustomizeScreenLookAndFeel.customizeMyScreen(this, textBoxBackColorPicker.BackColor);
                MetriconCommon.SetSettings("BackColor", "#" + colorDialog1.Color.Name);
            }
        }
コード例 #9
0
        private void frmHomeDisplayLookup_Load(object sender, EventArgs e)
        {
            this.Text = this.Text + " - " + MetriconCommon.WindowTitleInfo;
            this.homeTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();

            //when dataAdapter fill the dataset, query was written in PMO006STGDataSet.xsd file.
            //this.homeTableAdapter.FillHomeDisplayData(this.pMO006STGDataSet.Home);
            loadStateDropdown();
            LoadBrandList();
            loadStatusDropdown();
            fillByToolStripButton_Click(sender, e);

            // classCustomizeScreenLookAndFeel.customizeMyScreen(this);
        }
コード例 #10
0
ファイル: frmHomeLookup.cs プロジェクト: maverick126/RSM
        private void frmHomeLookup_Load(object sender, EventArgs e)
        {
            // TODO: This line of code loads data into the 'pMO006STGDataSet.Home' table. You can move, or remove it, as needed.
            this.Text = this.Text + " - " + MetriconCommon.WindowTitleInfo;
            this.homeTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();


            //this.homeTableAdapter.Fill(this.pMO006STGDataSet.Home);
            loadStateDropdown();
            LoadBrandList();
            loadStatusDropdown();
            loadShowOnPriceListDropdown();
            fillByToolStripButton_Click(sender, e);

            // classCustomizeScreenLookAndFeel.customizeMyScreen(this);
        }
コード例 #11
0
ファイル: frmAreaGroup.cs プロジェクト: maverick126/RSM
        private void btnSaveNewArea_Click(object sender, EventArgs e)
        {
            int sortOrder, active, sortOrder2;

            if (txtNewAreaName.Text.ToString() != "")
            {
                sortOrder  = MetriconCommon.initIntVariables(txtAreaSortOrder.Text.ToString());
                sortOrder2 = MetriconCommon.initIntVariables(txtDoubleSortOrder.Text.ToString());

                if (chkActive.Checked)
                {
                    active = 1;
                }
                else
                {
                    active = 0;
                }
                try
                {
                    MetriconCommon.DatabaseManager.ExecuteSQLQuery("spa_AdminAddEditArea", new System.Data.SqlClient.SqlParameter[7] {
                        new System.Data.SqlClient.SqlParameter("@areaID", -1)
                        , new System.Data.SqlClient.SqlParameter("@areaName", txtNewAreaName.Text)
                        , new System.Data.SqlClient.SqlParameter("@sortOrder", sortOrder)
                        , new System.Data.SqlClient.SqlParameter("@sortOrderDouble", sortOrder2)
                        , new System.Data.SqlClient.SqlParameter("@active", active)
                        , new System.Data.SqlClient.SqlParameter("@action", "NEW")
                        , new System.Data.SqlClient.SqlParameter("@CreatedBy", MetriconCommon.UserCode)
                    });
                }
                catch (SqlException ex1)
                {
                    MessageBox.Show(ex1.Message.ToString());
                }
                panel1.Visible = false;
                loadAreas();
            }
            else
            {
                MessageBox.Show("Please enter area name.");
            }
        }
コード例 #12
0
ファイル: frmAreaGroup.cs プロジェクト: maverick126/RSM
        private void btnSaveNewGroup_Click(object sender, EventArgs e)
        {
            int sortOrder, active, studiomsortorder;

            if (txtNewGroupName.Text.ToString() != "")
            {
                sortOrder        = MetriconCommon.initIntVariables(txtNewGroupSortOrder.Text.ToString());
                studiomsortorder = MetriconCommon.initIntVariables(txtStudioMsortorder.Text.ToString());
                if (chkActive2.Checked)
                {
                    active = 1;
                }
                else
                {
                    active = 0;
                }
                try
                {
                    MetriconCommon.DatabaseManager.ExecuteSQLQuery("spa_AdminAddEditGroup", new System.Data.SqlClient.SqlParameter[7] {
                        new System.Data.SqlClient.SqlParameter("@groupID", -1)
                        , new System.Data.SqlClient.SqlParameter("@groupName", txtNewGroupName.Text)
                        , new System.Data.SqlClient.SqlParameter("@sortOrder", txtNewGroupSortOrder.Text)
                        , new System.Data.SqlClient.SqlParameter("@active", active)
                        , new System.Data.SqlClient.SqlParameter("@action", "NEW")
                        , new System.Data.SqlClient.SqlParameter("@CreatedBy", MetriconCommon.UserCode)
                        , new System.Data.SqlClient.SqlParameter("@studiomsortorder", studiomsortorder)
                    });
                }
                catch (SqlException ex1)
                {
                    MessageBox.Show(ex1.Message.ToString());
                }
                panel2.Visible = false;
                loadGroups();
            }
            else
            {
                MessageBox.Show("Please enter group name.");
            }
        }
コード例 #13
0
ファイル: ServerManager.cs プロジェクト: maverick126/RSM
    public DataSet ExecuteSQLQuery(string sqlStoredProcedure, SqlParameter[] myParameters)
    {
        try
        {
            mySQLConnection = new SqlConnection(this.sSQLConnectionString);
            mySQLAdapter    = new SqlDataAdapter(sqlStoredProcedure, mySQLConnection);
            myDataSet       = new DataSet();

            //mySQLAdapter.SelectCommand = new SqlCommand(sqlStoredProcedure);
            mySQLAdapter.SelectCommand.CommandTimeout = 7200;
            mySQLAdapter.SelectCommand.Connection     = mySQLConnection;
            mySQLAdapter.SelectCommand.CommandType    = CommandType.StoredProcedure;

            mySQLConnection.Open();
            foreach (SqlParameter tempParam in myParameters)
            {
                mySQLAdapter.SelectCommand.Parameters.Add(tempParam);
            }

            mySQLAdapter.Fill(myDataSet);
        }
        catch (Exception e)
        {
            MetriconCommon.LogToFile("", "", "ServerManager.ExecuteSQLQuery", e.Message.ToString());
            throw e;
        }
        finally
        {
            //if there are no tables add default table
            if (myDataSet.Tables.Count == 0)
            {
                myDataSet.Tables.Add(new DataTable("NoRecords"));
            }
            mySQLConnection.Close();
            mySQLConnection.Dispose();
        }
        return(myDataSet);
    }
コード例 #14
0
ファイル: frmPrice.cs プロジェクト: maverick126/RSM
 private void textBoxDBCCost_Leave(object sender, EventArgs e)
 {
     ApplyCMA();
     MetriconCommon.ToCurrency(ref textBoxDBCCost);
 }
コード例 #15
0
ファイル: frmPrice.cs プロジェクト: maverick126/RSM
 private void textBoxDBCCost_Enter(object sender, EventArgs e)
 {
     MetriconCommon.ToDouble(ref textBoxDBCCost);
 }
コード例 #16
0
ファイル: ServerManager.cs プロジェクト: maverick126/RSM
 public void SetConnectionString()
 {
     this.sSQLConnectionString = MetriconCommon.getConnectionString();
 }
コード例 #17
0
ファイル: frmPrice.cs プロジェクト: maverick126/RSM
 private void txtSellPrice_Enter(object sender, EventArgs e)
 {
     MetriconCommon.ToDouble(ref txtSellPrice);
 }
コード例 #18
0
ファイル: frmPrice.cs プロジェクト: maverick126/RSM
 private void txtSellPrice_Leave(object sender, EventArgs e)
 {
     MetriconCommon.ToCurrency(ref txtSellPrice);
 }
コード例 #19
0
ファイル: frmHomeDisplay.cs プロジェクト: maverick126/RSM
        public void SaveForm()
        {
            string action, suburb, postcode, estatename;
            int    bedroom, bathroom, storey, brandID, sortOrder, parentHomeID, HomeID, regionID, originalparentHomeID, originaldisplayHomeID, stateID;
            double houseArea, houseAreaSquare, alfrescoArea, alfrescoAreaSquares, garageArea, garageAreaSquares, blocksize;
            double totalArea, totalAreaSquares, minimumBlockWidth, houseLength, houseWidth, garageBays;
            string displayclosedate = "";

            //initialize all blank integer field
            if (txtParentHomeID.Text != "")
            {
                if (txtProductID.Text != "")
                {
                    success           = 1;
                    bedroom           = MetriconCommon.initIntVariables(dropBedrooms.Text.ToString());
                    bathroom          = MetriconCommon.initIntVariables(dropBathrooms.Text.ToString());
                    storey            = MetriconCommon.initIntVariables(dropStoreys.Text.ToString());
                    dropBrand.Enabled = true;
                    brandID           = MetriconCommon.initIntVariables(dropBrand.SelectedValue.ToString());
                    dropBrand.Enabled = false;
                    stateID           = Int32.Parse(dropdownState.SelectedValue.ToString());
                    sortOrder         = MetriconCommon.initIntVariables(txtSortOrder.Text.ToString());
                    HomeID            = MetriconCommon.initIntVariables(txtHomeID.Text.ToString());
                    parentHomeID      = MetriconCommon.initIntVariables(txtParentHomeID.Text.ToString());

                    //regionID = MetriconCommon.initIntVariables(dropRegion.SelectedValue.ToString());
                    originalparentHomeID  = MetriconCommon.initIntVariables(txtOriginalHomeID.Text.ToString());
                    originaldisplayHomeID = MetriconCommon.initIntVariables(txtOriginalDisHomeID.Text.ToString());

                    //initialize all blank decimal field
                    houseArea           = MetriconCommon.initDoubleVariables(txtHouseArea.Text.ToString());
                    houseAreaSquare     = MetriconCommon.initDoubleVariables(txtHouseAreaSquares.Text.ToString());
                    alfrescoArea        = MetriconCommon.initDoubleVariables(txtAlfrescoArea.Text.ToString());
                    alfrescoAreaSquares = MetriconCommon.initDoubleVariables(txtAlfrescoAreaSquares.Text.ToString());
                    garageArea          = MetriconCommon.initDoubleVariables(txtGarageArea.Text.ToString());
                    garageAreaSquares   = MetriconCommon.initDoubleVariables(txtGarageAreaSquares.Text.ToString());
                    totalArea           = MetriconCommon.initDoubleVariables(txtTotalArea.Text.ToString());
                    totalAreaSquares    = MetriconCommon.initDoubleVariables(txtTotalAreaSquares.Text.ToString());
                    minimumBlockWidth   = MetriconCommon.initDoubleVariables(txtMinimumBlockWidth.Text.ToString());
                    houseLength         = MetriconCommon.initDoubleVariables(txtHouseLength.Text.ToString());
                    houseWidth          = MetriconCommon.initDoubleVariables(txtHouseWidth.Text.ToString());
                    garageBays          = MetriconCommon.initDoubleVariables(txtGarageBays.Text.ToString());

                    if (txtclosedate.Text != "")
                    {
                        displayclosedate = dateTimePicker1.Value.ToString("dd/MMM/yyyy");
                    }


                    string sb;
                    try
                    {
                        sb = dropSuburb.SelectedItem.ToString();
                    }
                    catch (Exception ex)
                    {
                        sb = dropSuburb.Text;
                    }

                    try
                    {
                        estatename = dropEstate.SelectedItem.ToString();
                    }
                    catch (Exception ex)
                    {
                        estatename = dropEstate.Text;
                    }

                    if (txtLotAddress.Text == "")
                    {
                        success = 0;
                        MessageBox.Show("Please enter the lot address!");
                        return;
                    }
                    if (sb == "")
                    {
                        suburb   = "";
                        postcode = "";
                        success  = 0;
                        MessageBox.Show("Please select appropriate suburb!");
                        return;
                    }
                    else
                    {
                        suburb   = sb.Substring(0, sb.IndexOf("(") - 1);
                        postcode = sb.Substring(sb.IndexOf("(") + 1, sb.IndexOf(")") - sb.IndexOf("(") - 1);
                    }

                    if (estatename == "")
                    {
                        success = 0;
                        MessageBox.Show("Please select the estate!");
                        return;
                    }


                    try
                    {
                        if (txtBlockSize.Text != "")
                        {
                            blocksize = double.Parse(txtBlockSize.Text);
                        }
                        else
                        {
                            success = 0;
                            MessageBox.Show("Please select appropriate block size!!");
                            return;
                        }
                    }
                    catch
                    {
                        success = 0;
                        MessageBox.Show("Please select appropriate block size!!");
                        return;
                    }
                    //if (radioButton1.Checked)
                    //{
                    //    if (dropSuburb.SelectedValue != null)
                    //    {
                    //        suburb = dropSuburb.SelectedValue.ToString();
                    //    }
                    //    else
                    //    {
                    //        suburb = "";
                    //        success = 0;
                    //        MessageBox.Show("Please select appropriate suburb!!");
                    //    }
                    //}
                    //else
                    //{
                    //    suburb = txtSuburb.Text.ToString();
                    //}

                    if (mode == InputFormMode.New)
                    {
                        action = "NEW";
                    }
                    else
                    {
                        action = "EDIT";
                    }

                    if (suburb != "")
                    {
                        //execute procedure to save data
                        //this.pictureBox1.Visible = true;
                        MetriconCommon.DatabaseManager.ExecuteSQLQuery("AdminAddEditHomeDisplay", new System.Data.SqlClient.SqlParameter[52]
                        {
                            new System.Data.SqlClient.SqlParameter("@HomeID", HomeID)
                            , new System.Data.SqlClient.SqlParameter("@HomePlan", txtHomePlan.Text)
                            , new System.Data.SqlClient.SqlParameter("@HomeFacade", txtHomeFacade.Text)
                            , new System.Data.SqlClient.SqlParameter("@StateID", stateID)
                            , new System.Data.SqlClient.SqlParameter("@BrandID", brandID)
                            , new System.Data.SqlClient.SqlParameter("@ProductID", txtProductID.Text)
                            , new System.Data.SqlClient.SqlParameter("@HouseArea", houseArea)
                            , new System.Data.SqlClient.SqlParameter("@HouseAreaSquares", houseAreaSquare)
                            , new System.Data.SqlClient.SqlParameter("@AlfrescoArea", alfrescoArea)
                            , new System.Data.SqlClient.SqlParameter("@AlfrescoAreaSquares", alfrescoAreaSquares)
                            , new System.Data.SqlClient.SqlParameter("@GarageArea", garageArea)
                            , new System.Data.SqlClient.SqlParameter("@GarageAreaSquares", garageAreaSquares)
                            , new System.Data.SqlClient.SqlParameter("@TotalArea", totalArea)
                            , new System.Data.SqlClient.SqlParameter("@TotalAreaSquares", totalAreaSquares)
                            , new System.Data.SqlClient.SqlParameter("@Min_Block_Width", minimumBlockWidth)
                            , new System.Data.SqlClient.SqlParameter("@HouseLength", houseLength)
                            , new System.Data.SqlClient.SqlParameter("@HouseWidth", houseWidth)
                            , new System.Data.SqlClient.SqlParameter("@GarageBays", garageBays)
                            , new System.Data.SqlClient.SqlParameter("@Bedrooms", bedroom)
                            , new System.Data.SqlClient.SqlParameter("@Bathrooms", bathroom)
                            , new System.Data.SqlClient.SqlParameter("@Stories", storey)
                            , new System.Data.SqlClient.SqlParameter("@DESC", txtDesc.Text)
                            , new System.Data.SqlClient.SqlParameter("@EDESC", txtEdesc.Text)
                            , new System.Data.SqlClient.SqlParameter("@CSTCTR", txtCstctr.Text)
                            , new System.Data.SqlClient.SqlParameter("@SUOFM", txtSuofm.Text)
                            , new System.Data.SqlClient.SqlParameter("@PUOFM", txtPuofm.Text)
                            , new System.Data.SqlClient.SqlParameter("@PRDCAT", txtPrdcat.Text)
                            , new System.Data.SqlClient.SqlParameter("@TAXCD", txtTaxcd.Text)
                            , new System.Data.SqlClient.SqlParameter("@PRDSOP", txtPrdsop.Text)
                            , new System.Data.SqlClient.SqlParameter("@USRDEF", txtUsrdef.Text)
                            , new System.Data.SqlClient.SqlParameter("@LDESC", txtLdesc.Text)
                            , new System.Data.SqlClient.SqlParameter("@BRAND", txtBrand.Text)
                            , new System.Data.SqlClient.SqlParameter("@SPECYEAR", txtSpecyear.Text)
                            , new System.Data.SqlClient.SqlParameter("@HOUSECODE", txtHousecode.Text)
                            , new System.Data.SqlClient.SqlParameter("@HOUSESIZE", txtHousesize.Text)
                            , new System.Data.SqlClient.SqlParameter("@HOUSEFACADE", txtHousefacade.Text)
                            , new System.Data.SqlClient.SqlParameter("@STOREY", txtStorey.Text)
                            , new System.Data.SqlClient.SqlParameter("@MARK", txtMark.Text)
                            , new System.Data.SqlClient.SqlParameter("@SortOrder", txtSortOrder.Text)
                            , new System.Data.SqlClient.SqlParameter("@CreatedBy", MetriconCommon.UserCode)
                            , new System.Data.SqlClient.SqlParameter("@Active", chkActive.Checked)
                            , new System.Data.SqlClient.SqlParameter("@draft", chkDraft.Checked)
                            , new System.Data.SqlClient.SqlParameter("@parentHomeID", parentHomeID)
                            , new System.Data.SqlClient.SqlParameter("@action", action)
                            , new System.Data.SqlClient.SqlParameter("@lotAddress", txtLotAddress.Text)
                            , new System.Data.SqlClient.SqlParameter("@suburb", suburb)
                            , new System.Data.SqlClient.SqlParameter("@postcode", postcode)
                            , new System.Data.SqlClient.SqlParameter("@blocksize", blocksize)
                            , new System.Data.SqlClient.SqlParameter("@originalParentHomeID", originalparentHomeID)
                            , new System.Data.SqlClient.SqlParameter("@originalDisplayHomeID", originaldisplayHomeID)
                            , new System.Data.SqlClient.SqlParameter("@estatename", estatename)
                            , new System.Data.SqlClient.SqlParameter("@displayclosedate", displayclosedate)
                        }
                                                                       );
                        //get the id of the new house that was inserted
                        //DataSet dsTemp = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select max(homeid) as homeid from home");

                        //this.txtHomeID.Text = dsTemp.Tables[0].Rows.Count == 1 ? dsTemp.Tables[0].Rows[0]["homeid"].ToString() : "";
                        if (action == "NEW")
                        {
                            DataSet dsTemp = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select max(homeid) as homeid from home");
                            this.txtHomeID.Text = dsTemp.Tables[0].Rows.Count == 1 ? dsTemp.Tables[0].Rows[0]["homeid"].ToString() : "";
                        }
                        this.pictureBox1.Visible = false;
                    }
                }
                else
                {
                    success = 0;
                    MessageBox.Show("Please select a facade!", "Missing Fields", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else
            {
                success = 0;
                MessageBox.Show("Please select a parent home!", "Missing Fields", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }
コード例 #20
0
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            string  enterdesc = "";
            int     active, active2;
            decimal qty;

            qty = 0;
            bool so, si, changeqty, changeprice, addextradesc;


            try
            {
                if (dataGridView1.Rows.Count != 0)
                {
                    this.adminSearchHomeDisplayOptionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();

                    DataRow modifiedRow = ((DataRowView)this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row;

                    DataSet dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select active from homedisplayoption_Staging where productareagroupid=" + modifiedRow["productareagroupid"].ToString() + " and homeid=" + modifiedRow["homeid"].ToString() + " and homedisplayid=" + modifiedRow["homedisplayid"].ToString());
                    if (dsHome.Tables[0].Rows[0][0].ToString() == "False")
                    {
                        active = 0;
                    }
                    else
                    {
                        active = 1;
                    }
                    if (modifiedRow["active"].ToString() == "True")
                    {
                        active2 = 1;
                    }
                    else
                    {
                        active2 = 0;
                    }
                    //modifiedRow["EnterDesc"] = "Note: Stained finish to KDHW components on this stair are non-standard and cannot be offered." + DateTime.Now.ToLongTimeString();
                    if (modifiedRow["EnterDesc"] != null && modifiedRow["EnterDesc"].ToString() != "")
                    {
                        enterdesc = modifiedRow["EnterDesc"].ToString();
                    }
                    if (modifiedRow["quantity"] != null && modifiedRow["quantity"].ToString() != "")
                    {
                        try
                        {
                            qty = decimal.Parse(modifiedRow["quantity"].ToString());
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show("Quantity should be a number.");
                            return;
                        }
                    }

                    if (modifiedRow["standardoption"] != null && modifiedRow["standardoption"].ToString().ToUpper() == "TRUE")
                    {
                        so = true;
                    }
                    else
                    {
                        so = false;
                    }
                    if (modifiedRow["standardinclusion"] != null && modifiedRow["standardinclusion"].ToString().ToUpper() == "TRUE")
                    {
                        si = true;
                    }
                    else
                    {
                        si = false;
                    }

                    if (modifiedRow["changeqty"] != null && modifiedRow["changeqty"].ToString().ToUpper() == "TRUE")
                    {
                        changeqty = true;
                    }
                    else
                    {
                        changeqty = false;
                    }

                    if (modifiedRow["addextradesc"] != null && modifiedRow["addextradesc"].ToString().ToUpper() == "TRUE")
                    {
                        addextradesc = true;
                    }
                    else
                    {
                        addextradesc = false;
                    }

                    if (modifiedRow["changeprice"] != null && modifiedRow["changeprice"].ToString().ToUpper() == "TRUE")
                    {
                        changeprice = true;
                    }
                    else
                    {
                        changeprice = false;
                    }
                    if (active != active2)
                    {
                        var confirmResult = MessageBox.Show("Are you sure to delete this item ?",
                                                            "Confirm Delete!!",
                                                            MessageBoxButtons.YesNo);
                        if (confirmResult == DialogResult.Yes)
                        {
                            dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("[AdminEditHDO]", new System.Data.SqlClient.SqlParameter[12]
                            {
                                new System.Data.SqlClient.SqlParameter("@StandardOption", so),
                                new System.Data.SqlClient.SqlParameter("@GeneralOption", false),
                                new System.Data.SqlClient.SqlParameter("@StandardInclusion", si),
                                new System.Data.SqlClient.SqlParameter("@Quantity", qty),
                                new System.Data.SqlClient.SqlParameter("@ModifiedDate", DateTime.Now),
                                new System.Data.SqlClient.SqlParameter("@ModifiedBy", MetriconCommon.UserCode),
                                new System.Data.SqlClient.SqlParameter("@Active", active2),
                                new System.Data.SqlClient.SqlParameter("@ChangeQty", changeqty),
                                new System.Data.SqlClient.SqlParameter("@AddExtraDesc", addextradesc),
                                new System.Data.SqlClient.SqlParameter("@EnterDesc", enterdesc),
                                new System.Data.SqlClient.SqlParameter("@ChangePrice", changeprice),
                                new System.Data.SqlClient.SqlParameter("@OptionID", Int32.Parse(modifiedRow["optionID"].ToString())),
                            }

                                                                                    );
                            dataGridView1.Rows.RemoveAt(e.RowIndex);
                        }
                        else
                        {
                            modifiedRow["active"] = "True";
                            return;
                        }
                    }
                    else
                    {
                        dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("[AdminEditHDO]", new System.Data.SqlClient.SqlParameter[12]
                        {
                            new System.Data.SqlClient.SqlParameter("@StandardOption", so),
                            new System.Data.SqlClient.SqlParameter("@GeneralOption", false),
                            new System.Data.SqlClient.SqlParameter("@StandardInclusion", si),
                            new System.Data.SqlClient.SqlParameter("@Quantity", qty),
                            new System.Data.SqlClient.SqlParameter("@ModifiedDate", DateTime.Now),
                            new System.Data.SqlClient.SqlParameter("@ModifiedBy", MetriconCommon.UserCode),
                            new System.Data.SqlClient.SqlParameter("@Active", active2),
                            new System.Data.SqlClient.SqlParameter("@ChangeQty", changeqty),
                            new System.Data.SqlClient.SqlParameter("@AddExtraDesc", addextradesc),
                            new System.Data.SqlClient.SqlParameter("@EnterDesc", enterdesc),
                            new System.Data.SqlClient.SqlParameter("@ChangePrice", changeprice),
                            new System.Data.SqlClient.SqlParameter("@OptionID", Int32.Parse(modifiedRow["optionID"].ToString())),
                        }

                                                                                );
                    }
                }
            }
            catch (IndexOutOfRangeException ex1)
            {
                //MessageBox.Show(ex1.Message.ToString());
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message.ToString());
            }
        }
コード例 #21
0
ファイル: frmMain.cs プロジェクト: maverick126/RSM
 private void verticalFormatToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MetriconCommon.GenerateExcel("Price", "VERTICAL");
 }
コード例 #22
0
ファイル: frmMain.cs プロジェクト: maverick126/RSM
 private void downloadFormatSheetToolStripMenuItem1_Click(object sender, EventArgs e)
 {
     MetriconCommon.GenerateExcel("Quantity", "");
 }
コード例 #23
0
ファイル: frmMain.cs プロジェクト: maverick126/RSM
 private void horizToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MetriconCommon.GenerateExcel("Price", "HORIZONTAL");
 }
コード例 #24
0
ファイル: frmMain.cs プロジェクト: maverick126/RSM
 private void downLoadFormatSheetToolStripMenuItem_Click(object sender, EventArgs e)
 {
     MetriconCommon.GenerateExcel("Product", "");
 }
コード例 #25
0
ファイル: frmPromotion.cs プロジェクト: maverick126/RSM
        private void savePromotion()
        {
            int    promID, promTypeID, active, published, stories, sortorder, brandID, goAhead;;
            double promCost, promBudget;
            string tempdate, action;

            tempdate = "";
            goAhead  = 1;

            if (txtBaseProductID.Text.ToString() != "")
            {
                promID     = MetriconCommon.initIntVariables(txtPromID.Text.ToString());
                promTypeID = MetriconCommon.initIntVariables(dropPromType.SelectedValue.ToString());

                brandID   = MetriconCommon.initIntVariables(dropBrand.SelectedValue.ToString());
                stories   = MetriconCommon.initIntVariables(txtStories.Text.ToString());
                sortorder = MetriconCommon.initIntVariables(txtSortOrder.Text.ToString());

                if (this.chkActive.Checked)
                {
                    active = 1;
                }
                else
                {
                    active = 0;
                }
                if (this.chkPublished.Checked)
                {
                    goAhead   = checkPAG();
                    published = 1;
                    if (txtEffectiveDate.Text == "")
                    {
                        MessageBox.Show("Please enter an effective date!");
                    }
                    else
                    {
                        try
                        {
                            DateTime tempdate3 = DateTime.Parse(txtEffectiveDate.Text.ToString());
                            tempdate = tempdate3.ToString("dd/MMM/yyyy");
                        }
                        catch (FormatException ex)
                        {
                            MessageBox.Show("Please enter a valid effective date! " + ex.ToString());
                        }
                    }
                }
                else
                {
                    published = 0;
                }

                if (goAhead == 1)
                {
                    promCost   = MetriconCommon.initDoubleVariables(txtPromCost.Text.ToString());
                    promBudget = MetriconCommon.initDoubleVariables(txtPromBudget.Text.ToString());

                    if (txtPromID.Text == "")
                    {
                        action = "NEW";
                    }
                    else
                    {
                        action = "EDIT";
                    }

                    // insert data to tabel
                    MetriconCommon.DatabaseManager.ExecuteSQLQuery("AdminAddEditPromotion", new System.Data.SqlClient.SqlParameter[15] {
                        new System.Data.SqlClient.SqlParameter("@promID", promID)
                        , new System.Data.SqlClient.SqlParameter("@promTypeID", promTypeID)
                        , new System.Data.SqlClient.SqlParameter("@promname", txtPromName.Text)
                        , new System.Data.SqlClient.SqlParameter("@baseProductID", txtBaseProductID.Text)
                        , new System.Data.SqlClient.SqlParameter("@budgetProductID", txtBudgetProductID.Text)
                        , new System.Data.SqlClient.SqlParameter("@promCost", promCost)
                        , new System.Data.SqlClient.SqlParameter("@promBudget", promBudget)
                        , new System.Data.SqlClient.SqlParameter("@published", published)
                        , new System.Data.SqlClient.SqlParameter("@sortorder", sortorder)
                        , new System.Data.SqlClient.SqlParameter("@brandID", brandID)
                        , new System.Data.SqlClient.SqlParameter("@stories", stories)
                        , new System.Data.SqlClient.SqlParameter("@effectiveDate", tempdate)
                        , new System.Data.SqlClient.SqlParameter("@active", active)
                        , new System.Data.SqlClient.SqlParameter("@CreatedBy", MetriconCommon.UserCode)
                        , new System.Data.SqlClient.SqlParameter("@action", action)
                    }
                                                                   );

                    // get new promotion ID and show on screen
                    if (action == "NEW")
                    {
                        DataSet dsTemp = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select max(promotionID) as promID from promotion");
                        this.txtPromID.Text = dsTemp.Tables[0].Rows.Count == 1 ? dsTemp.Tables[0].Rows[0]["promID"].ToString() : "";

                        this.btnAddPAG.Enabled = true;
                    }
                    MessageBox.Show("Data saved successfully!");
                }
                else
                {
                    MessageBox.Show("No PAG in current promotion! Please add PAG to this promotion and publish again!");
                }
            }
            else
            {
                MessageBox.Show("Please enter a base product ID!");
            }
        }
コード例 #26
0
ファイル: frmPrice.cs プロジェクト: maverick126/RSM
 private void textBoxTargetMargin_Leave(object sender, EventArgs e)
 {
     MetriconCommon.ToDouble(ref textBoxTargetMargin);
 }
コード例 #27
0
ファイル: frmPAGWizard.cs プロジェクト: maverick126/RSM
 private void txtQuantity_Enter(object sender, EventArgs e)
 {
     MetriconCommon.ToDouble(ref txtQuantity);
 }
コード例 #28
0
        private void dataGridView1_CellEndEdit(object sender, DataGridViewCellEventArgs e)
        {
            int  active, active2, qty;
            bool so, si, changeprice, changeqty, addextradesc;

            qty = 0;
            try
            {
                if (dataGridView1.Rows.Count != 0)
                {
                    this.adminSearchHomeDisplayOptionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();

                    DataRow modifiedRow = ((DataRowView)this.dataGridView1.Rows[e.RowIndex].DataBoundItem).Row;

                    DataSet dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("select active from homedisplayoption_Staging where productareagroupid=" + modifiedRow["productareagroupid"].ToString() + " and homeid=" + modifiedRow["homeid"].ToString());
                    if (dsHome.Tables[0].Rows[0][0].ToString() == "False")
                    {
                        active = 0;
                    }
                    else
                    {
                        active = 1;
                    }
                    if (modifiedRow["active"].ToString() == "True")
                    {
                        active2 = 1;
                    }
                    else
                    {
                        active2 = 0;
                    }
                    //modifiedRow["EnterDesc"] = "Note: Stained finish to KDHW components on this stair are non-standard and cannot be offered." + DateTime.Now.ToLongTimeString();
                    if (modifiedRow["standardoption"] != null && modifiedRow["standardoption"].ToString().ToUpper() == "TRUE")
                    {
                        so = true;
                    }
                    else
                    {
                        so = false;
                    }
                    if (modifiedRow["standardinclusion"] != null && modifiedRow["standardinclusion"].ToString().ToUpper() == "TRUE")
                    {
                        si = true;
                    }
                    else
                    {
                        si = false;
                    }

                    if (modifiedRow["changeqty"] != null && modifiedRow["changeqty"].ToString().ToUpper() == "TRUE")
                    {
                        changeqty = true;
                    }
                    else
                    {
                        changeqty = false;
                    }

                    if (modifiedRow["addextradesc"] != null && modifiedRow["addextradesc"].ToString().ToUpper() == "TRUE")
                    {
                        addextradesc = true;
                    }
                    else
                    {
                        addextradesc = false;
                    }

                    if (modifiedRow["changeprice"] != null && modifiedRow["changeprice"].ToString().ToUpper() == "TRUE")
                    {
                        changeprice = true;
                    }
                    else
                    {
                        changeprice = false;
                    }
                    if (active != active2)
                    {
                        dsHome = MetriconCommon.DatabaseManager.ExecuteSQLQuery("[AdminEditHDO]", new System.Data.SqlClient.SqlParameter[12]
                        {
                            new System.Data.SqlClient.SqlParameter("@StandardOption", so),
                            new System.Data.SqlClient.SqlParameter("@GeneralOption", false),
                            new System.Data.SqlClient.SqlParameter("@StandardInclusion", si),
                            new System.Data.SqlClient.SqlParameter("@Quantity", qty),
                            new System.Data.SqlClient.SqlParameter("@ModifiedDate", "01/01/06"),
                            new System.Data.SqlClient.SqlParameter("@ModifiedBy", MetriconCommon.UserCode),
                            new System.Data.SqlClient.SqlParameter("@Active", active2),
                            new System.Data.SqlClient.SqlParameter("@ChangeQty", changeqty),
                            new System.Data.SqlClient.SqlParameter("@AddExtraDesc", addextradesc),
                            new System.Data.SqlClient.SqlParameter("@EnterDesc", "none"),
                            new System.Data.SqlClient.SqlParameter("@ChangePrice", changeprice),
                            new System.Data.SqlClient.SqlParameter("@OptionID", Int32.Parse(modifiedRow["optionID"].ToString())),
                        }

                                                                                );
                        //modifiedRow["ModifiedBy"] = MetriconCommon.UserCode;
                        //modifiedRow["ModifiedDate"] = DateTime.Now.ToString();
                        //this.adminSearchHomeDisplayOptionTableAdapter.Update(modifiedRow);
                    }
                }
            }
            catch (IndexOutOfRangeException ex1)
            {
                //MessageBox.Show(ex1.Message.ToString());
            }
            catch (Exception ex2)
            {
                MessageBox.Show(ex2.Message.ToString());
            }
        }
コード例 #29
0
        private void frmDisplayHomeDisplayOption_Load(object sender, EventArgs e)
        {
            this.adminSearchHomeDisplayOptionTableAdapter.Connection.ConnectionString = MetriconCommon.getConnectionString();

            btnSearchDisHomeID_Click(sender, e);
            loadArea();
            loadGroup();
            if (txtDisHomeID.Text.ToString() != "")
            {
                loadPAGList();
                loadPAGList2();
                LoadDisplayHomeDetails();
            }


            this.listView2.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.listView2_ItemChecked);

            // classCustomizeScreenLookAndFeel.customizeMyScreen(this);
        }