Esempio n. 1
0
        private void Control_Init()
        {
            CurrencyMgr myCurrencyMgr = new CurrencyMgr();

            List <Currency> myCurrencies = myCurrencyMgr.Get_Currencies();

            DataList_CurrencyList.DataSource = myCurrencies;
            DataList_CurrencyList.DataBind();

            if (DataEval.IsEmptyQuery(_currencyid))
            {
                _currencyid             = myCurrencies[0].CurrencyID;
                ViewState["CurrencyID"] = _currencyid;
            }

            Currency selectCurrency = myCurrencyMgr.Get_Currency(_currencyid);

            GridView_Currency.DataSource = myCurrencyMgr.Get_Currency_OriginRates(selectCurrency.CurrencyID);
            GridView_Currency.DataBind();



            lbl_Currency_Name.Text = string.Format("{0} ({1})", selectCurrency.Currency_Name, selectCurrency.Currency_ShortName);

            MultiView_Currency.SetActiveView(View_CurrencyList);

            Panel_EditExchangeRate.Visible = false;

            #region Create Exchange Rate Table

            // Header
            Literal_ExchangeRate.Text = "<Table class='exchangeRate'> \n"
                                        + "<tr>\n <td></td> \n";

            foreach (Currency myCurrency in myCurrencies)
            {
                Literal_ExchangeRate.Text += "<td>" + myCurrency.Currency_ShortName + "</td> \n";
            }

            Literal_ExchangeRate.Text += "</tr> \n";

            // Sider
            foreach (Currency myCurrency in myCurrencies)
            {
                Literal_ExchangeRate.Text += "<tr>\n <td>" + myCurrency.Currency_ShortName + "</td> \n";

                List <Currency_Rate> myCurrency_Rates = myCurrencyMgr.Get_Currency_OriginRates(myCurrency.CurrencyID);

                // Body
                foreach (Currency_Rate myCurrency_Rate in myCurrency_Rates)
                {
                    Literal_ExchangeRate.Text += "<td>" + string.Format("{0:f}", myCurrency_Rate.Exchange_Rate) + "</td> \n";
                }

                Literal_ExchangeRate.Text += "</tr> \n";
            }

            // Footer
            Literal_ExchangeRate.Text += "</Table> \n";


            #endregion
        }
Esempio n. 2
0
        private void Control_FillData()
        {
            ProductVariantMgr myProductVariantMgr = new ProductVariantMgr();
            ProductMgr        myProductMgr        = new ProductMgr();
            CurrencyMgr       myCurrencyMgr       = new CurrencyMgr();

            // Step 1 Product Variant
            droplist_Product_VariantID.DataSource     = myProductVariantMgr.Get_Product_Variants();
            droplist_Product_VariantID.DataTextField  = "Variant_Name";
            droplist_Product_VariantID.DataValueField = "Product_VariantID";
            droplist_Product_VariantID.DataBind();
            droplist_Product_VariantID.SelectedIndex = 0;

            tbx_Filter_ProductIndex_Title.Text      = "";
            droplist_Filter_OrderBy.SelectedIndex   = 0;
            droplist_Filter_Direction.SelectedIndex = 0;

            lbl_Selected_Product_Index.Text = "Unselected";

            // Step 2 Product Index
            tbx_Index_Title.Text             = "";
            tbx_Index_Short_Description.Text = "";
            tbx_Index_Admin_Comment.Text     = "";
            chkbox_Index_IsActive.Checked    = true;

            // Step 3 Product
            lbl_Product_Index.Text = "";

            #region Product Title Format

            //Gets your enum names and adds it to a string array
            Array enumTitleNames = Enum.GetValues(typeof(Title_Type));

            //Creates an ArrayList
            ArrayList myTitleFormats = new ArrayList();

            //Loop through your string array and poppulates the ArrayList
            foreach (Title_Type myTitle_Type in enumTitleNames)
            {
                myTitleFormats.Add(new
                {
                    Value = myTitle_Type.ToString(),
                    Name  = StringEnum.GetStringValue(myTitle_Type)
                });
            }

            //Bind the ArrayList to your DropDownList
            rbtn_Product_Title_Type.DataSource     = myTitleFormats;
            rbtn_Product_Title_Type.DataTextField  = "Name";
            rbtn_Product_Title_Type.DataValueField = "Value";
            rbtn_Product_Title_Type.DataBind();

            // Set Default value
            rbtn_Product_Title_Type.SelectedValue = Title_Type.Override.ToString();

            #endregion

            tbx_Product_Title.Text = "";
            tbx_Product_SKU.Text   = "";

            droplist_Product_ManufacturerID.DataSource     = myProductMgr.Get_Manufacturers("Name", true.ToString());
            droplist_Product_ManufacturerID.DataTextField  = "Name";
            droplist_Product_ManufacturerID.DataValueField = "ManufacturerID";
            droplist_Product_ManufacturerID.DataBind();
            droplist_Product_ManufacturerID.SelectedIndex = 0;

            tbx_Product_Manufacturer_SKU.Text = "";

            droplist_Product_CurrencyID.DataSource     = myCurrencyMgr.Get_Currencies("Currency_Name", true.ToString());
            droplist_Product_CurrencyID.DataTextField  = "Currency_ShortName";
            droplist_Product_CurrencyID.DataValueField = "CurrencyID";
            droplist_Product_CurrencyID.DataBind();
            droplist_Product_CurrencyID.SelectedIndex = 0;

            RadNumericTextBox_Product_RRP.Text = "0.00";
            chkbox_Product_IsActive.Checked    = true;
        }
Esempio n. 3
0
        protected void btn_Add_Currency_Create_Click(object sender, EventArgs e)
        {
            if (Page.IsValid)
            {
                string nowDateTime = DateTime.Now.ToString();
                string UserID      = Nexus.Security.Users.UserStatus.Current_UserID(this.Page);

                CurrencyMgr myCurrencyMgr = new CurrencyMgr();

                List <Currency> myCurrencies = myCurrencyMgr.Get_Currencies();


                // Add Currency
                string CurrencyID = Nexus.Core.Tools.IDGenerator.Get_New_GUID();

                e2Data[] UpdateData =
                {
                    new e2Data("CurrencyID",           CurrencyID),
                    new e2Data("Currency_Name",        tbx_AddCurrency_Name.Text),
                    new e2Data("Currency_ShortName",   tbx_AddCurrency_ShortName.Text),
                    new e2Data("Currency_WebCode",     tbx_AddCurrency_WebCode.Text),
                    new e2Data("Currency_Description", tbx_AddCurrency_Description.Text),
                    new e2Data("IsActive",             chkbox_AddCurrency_IsActive.Checked.ToString())
                };

                myCurrencyMgr.Add_Currency(UpdateData);
                Thread.Sleep(100);

                // Add Currency 1:1 Rate
                e2Data[] UpdateData_SelfRate =
                {
                    new e2Data("Origin_CurrencyID", CurrencyID),
                    new e2Data("Target_CurrencyID", CurrencyID),
                    new e2Data("Exchange_Rate",     "1"),
                    new e2Data("LastUpdate_Date",   nowDateTime),
                    new e2Data("LastUpdate_UserID", UserID)
                };

                myCurrencyMgr.Add_Currency_Rate(UpdateData_SelfRate);
                Thread.Sleep(100);

                // Add All other Currency
                foreach (Currency myCurrency in myCurrencies)
                {
                    e2Data[] UpdateData_Origin =
                    {
                        new e2Data("Origin_CurrencyID", CurrencyID),
                        new e2Data("Target_CurrencyID", myCurrency.CurrencyID),
                        new e2Data("Exchange_Rate",     "1"),
                        new e2Data("LastUpdate_Date",   nowDateTime),
                        new e2Data("LastUpdate_UserID", UserID)
                    };

                    myCurrencyMgr.Add_Currency_Rate(UpdateData_Origin);
                    Thread.Sleep(100);

                    e2Data[] UpdateData_Target =
                    {
                        new e2Data("Origin_CurrencyID", myCurrency.CurrencyID),
                        new e2Data("Target_CurrencyID", CurrencyID),
                        new e2Data("Exchange_Rate",     "1"),
                        new e2Data("LastUpdate_Date",   nowDateTime),
                        new e2Data("LastUpdate_UserID", UserID)
                    };

                    myCurrencyMgr.Add_Currency_Rate(UpdateData_Target);
                    Thread.Sleep(100);
                }

                // Finish Update
                Control_FillData();
                Control_Init();
            }
        }
Esempio n. 4
0
        public void Control_FillData()
        {
            ProductMgr  myProductMgr  = new ProductMgr();
            CurrencyMgr myCurrencyMgr = new CurrencyMgr();

            Product.Product myProduct = myProductMgr.Get_Product(_productid);

            #region Product Title Format

            //Gets your enum names and adds it to a string array
            Array enumTitleNames = Enum.GetValues(typeof(Title_Type));

            //Creates an ArrayList
            ArrayList myTitleFormats = new ArrayList();

            //Loop through your string array and poppulates the ArrayList
            foreach (Title_Type myTitle_Type in enumTitleNames)
            {
                myTitleFormats.Add(new
                {
                    Value = myTitle_Type.ToString(),
                    Name  = StringEnum.GetStringValue(myTitle_Type)
                });
            }

            //Bind the ArrayList to your DropDownList
            rbtn_Product_Title_Type.DataSource     = myTitleFormats;
            rbtn_Product_Title_Type.DataTextField  = "Name";
            rbtn_Product_Title_Type.DataValueField = "Value";
            rbtn_Product_Title_Type.DataBind();

            // Set Default value
            rbtn_Product_Title_Type.SelectedValue = Title_Type.Override.ToString();

            #endregion

            tbx_Product_Title.Text = "";
            tbx_Product_SKU.Text   = "";

            droplist_Product_ManufacturerID.Items.Clear();
            droplist_Product_ManufacturerID.DataSource     = myProductMgr.Get_Manufacturers("Name", true.ToString());
            droplist_Product_ManufacturerID.DataTextField  = "Name";
            droplist_Product_ManufacturerID.DataValueField = "ManufacturerID";
            droplist_Product_ManufacturerID.DataBind();
            droplist_Product_ManufacturerID.SelectedIndex = 0;

            tbx_Product_Manufacturer_SKU.Text = "";

            droplist_Product_CurrencyID.Items.Clear();
            droplist_Product_CurrencyID.DataSource     = myCurrencyMgr.Get_Currencies("Currency_Name", true.ToString());
            droplist_Product_CurrencyID.DataTextField  = "Currency_ShortName";
            droplist_Product_CurrencyID.DataValueField = "CurrencyID";
            droplist_Product_CurrencyID.DataBind();
            droplist_Product_CurrencyID.SelectedIndex = 0;

            RadNumericTextBox_Product_RRP.Text = "0.00";
            chkbox_Product_IsActive.Checked    = true;

            // Load Product Data
            rbtn_Product_Title_Type.SelectedValue = myProduct.Title_Type.ToString();
            tbx_Product_Title.Text = myProduct.Product_Title;
            tbx_Product_SKU.Text   = myProduct.Product_SKU;
            droplist_Product_ManufacturerID.SelectedValue = myProduct.ManufacturerID;
            tbx_Product_Manufacturer_SKU.Text             = myProduct.Manufacturer_SKU;
            droplist_Product_CurrencyID.SelectedValue     = myProduct.CurrencyID;
            RadNumericTextBox_Product_RRP.Text            = myProduct.RRP_Price.ToString();
            chkbox_Product_IsActive.Checked = myProduct.IsActive;

            _product_variantid             = myProduct.Product_VariantID;
            ViewState["Product_VariantID"] = _product_variantid;

            // Load Product Specification

            Panel_Updated.Visible = false;
            Product_Control_Init();
        }