private CurrencyManager getCurrencyManager()
 {
     if (null == _currencyManager) {
         _currencyManager = new CurrencyManager(config, getStorage());
     }
     return _currencyManager;
 }
 void Awake()
 {
     _tags = FindObjectOfType<Tags>();
     _currencyManager = FindObjectOfType<CurrencyManager>();
     _scoreManager = FindObjectOfType<ScoreManager>();
     _enemyMovement = FindObjectOfType<EnemyMovement>();
     _anim = GetComponent<Animator>();
 }
Exemple #3
0
        public Biller (UnibillConfiguration config, TransactionDatabase tDb, IBillingService billingSubsystem, ILogger logger, HelpCentre help, ProductIdRemapper remapper, CurrencyManager currencyManager) {
            this.InventoryDatabase = config;
            this.transactionDatabase = tDb;
            this.billingSubsystem = billingSubsystem;
            this.logger = logger;
            logger.prefix = "UnibillBiller";
            this.help = help;
            this.Errors = new List<UnibillError> ();
            this.remapper = remapper;
			this.currencyManager = currencyManager;
        }
        public void ShouldReturnExchange()
        {
            //Arrange
            var currencyManager = new CurrencyManager();

            //Act
            var rate = currencyManager.GetExchangeRate();

            //Assert
            Assert.That(rate, Is.Not.EqualTo(0));
        }
 void Awake()
 {
     _tags = FindObjectOfType<Tags>();
     _currencyManager = FindObjectOfType<CurrencyManager>();
 }
        public void MultiColumnedRelation()
        {
            DataSet   dataset  = new DataSet();
            DataTable sports   = new DataTable("Sports");
            DataTable athletes = new DataTable("Athletes");

            DataColumn column;
            DataRow    row;

            column            = new DataColumn();
            column.DataType   = typeof(int);
            column.ColumnName = "SportID";
            column.Unique     = true;
            sports.Columns.Add(column);

            column            = new DataColumn();
            column.DataType   = typeof(string);
            column.ColumnName = "SportName";
            sports.Columns.Add(column);


            string [] sports_names = new string [] { "Hockey", "Baseball", "Basketball", "Football", "Boxing", "Surfing" };
            for (int i = 0; i < sports_names.Length; i++)
            {
                row               = sports.NewRow();
                row ["SportID"]   = i;
                row ["SportName"] = sports_names [i];
                sports.Rows.Add(row);
            }


            // Athletes table
            column            = new DataColumn();
            column.DataType   = typeof(int);
            column.ColumnName = "AthleteID";
            column.Unique     = true;
            athletes.Columns.Add(column);

            column            = new DataColumn();
            column.DataType   = typeof(int);
            column.ColumnName = "Sport";
            athletes.Columns.Add(column);

            column            = new DataColumn();
            column.DataType   = typeof(string);
            column.ColumnName = "AthleteName";
            athletes.Columns.Add(column);

            string [] athlete_names = new string [] { "@alp", "@lupus", "@tjfontaine", "duncan", "marv", "WindowsUninstall",
                                                      "@jackson", "@migHome", "_Synced[work]", "GodZhila", "Raboo",
                                                      "@jchambers", "@mkestner", "barbosa", "IzeBurn", "squinky86",
                                                      "@kangaroo", "@paco", "Demian", "logiclrd", "tenshiKur0" };
            for (int i = 0; i < athlete_names.Length; i++)
            {
                row = athletes.NewRow();
                row ["AthleteID"]   = i;
                row ["Sport"]       = i % sports_names.Length;
                row ["AthleteName"] = athlete_names [i];
                athletes.Rows.Add(row);
            }

            dataset.Tables.Add(sports);
            dataset.Tables.Add(athletes);
            dataset.Relations.Add("AthletesSports", sports.Columns ["SportID"], athletes.Columns ["Sport"]);

            BindingContext  bc = new BindingContext();
            CurrencyManager cm = bc [dataset, "Sports.AthletesSports"] as CurrencyManager;

            Assert.AreEqual(0, cm.Position, "MC1");
            Assert.AreEqual(4, cm.Count, "MC2");

            DataRowView rowview = cm.Current as DataRowView;

            Assert.IsFalse(rowview == null, "MC3");
            Assert.AreEqual(0, rowview ["AthleteID"], "MC4");
            Assert.AreEqual("@alp", rowview ["AthleteName"], "MC5");
            Assert.AreEqual(0, rowview ["Sport"], "MC6");

            cm.Position++;

            rowview = cm.Current as DataRowView;
            Assert.IsFalse(rowview == null, "MC7");
            Assert.AreEqual(6, rowview ["AthleteID"], "MC8");
            Assert.AreEqual("@jackson", rowview ["AthleteName"], "MC9");
            Assert.AreEqual(0, rowview ["Sport"], "MC10");

            cm.Position++;

            rowview = cm.Current as DataRowView;
            Assert.IsFalse(rowview == null, "MC11");
            Assert.AreEqual(12, rowview ["AthleteID"], "MC12");
            Assert.AreEqual("@mkestner", rowview ["AthleteName"], "MC13");
            Assert.AreEqual(0, rowview ["Sport"], "MC14");

            cm.Position++;

            rowview = cm.Current as DataRowView;
            Assert.IsFalse(rowview == null, "MC15");
            Assert.AreEqual(18, rowview ["AthleteID"], "MC16");
            Assert.AreEqual("Demian", rowview ["AthleteName"], "MC17");
            Assert.AreEqual(0, rowview ["Sport"], "MC18");

            cm.Position++;

            rowview = cm.Current as DataRowView;
            Assert.IsFalse(rowview == null, "MC19");
            Assert.AreEqual(18, rowview ["AthleteID"], "MC20");
            Assert.AreEqual("Demian", rowview ["AthleteName"], "MC21");
            Assert.AreEqual(0, rowview ["Sport"], "MC22");
        }
Exemple #7
0
        /// <summary>
        /// Formats attributes
        /// </summary>
        /// <param name="productVariant">Product variant</param>
        /// <param name="attributes">Attributes</param>
        /// <param name="customer">Customer</param>
        /// <param name="serapator">Serapator</param>
        /// <param name="htmlEncode">A value indicating whether to encode (HTML) values</param>
        /// <param name="renderPrices">A value indicating whether to render prices</param>
        /// <param name="renderProductAttributes">A value indicating whether to render product attributes</param>
        /// <param name="renderGiftCardAttributes">A value indicating whether to render gift card attributes</param>
        /// <returns>Attributes</returns>
        public static string FormatAttributes(ProductVariant productVariant, string attributes,
                                              Customer customer, string serapator, bool htmlEncode, bool renderPrices,
                                              bool renderProductAttributes, bool renderGiftCardAttributes)
        {
            var result = new StringBuilder();

            //attributes
            if (renderProductAttributes)
            {
                var pvaCollection = ParseProductVariantAttributes(attributes);
                for (int i = 0; i < pvaCollection.Count; i++)
                {
                    var pva       = pvaCollection[i];
                    var valuesStr = ParseValues(attributes, pva.ProductVariantAttributeId);
                    for (int j = 0; j < valuesStr.Count; j++)
                    {
                        string valueStr     = valuesStr[j];
                        string pvaAttribute = string.Empty;
                        if (!pva.ShouldHaveValues)
                        {
                            if (pva.AttributeControlType == AttributeControlTypeEnum.MultilineTextbox)
                            {
                                pvaAttribute = string.Format("{0}: {1}", pva.ProductAttribute.Name, HtmlHelper.FormatText(valueStr, false, true, true, false, false, false));
                            }
                            else
                            {
                                pvaAttribute = string.Format("{0}: {1}", pva.ProductAttribute.Name, valueStr);
                            }
                        }
                        else
                        {
                            var pvaValue = ProductAttributeManager.GetProductVariantAttributeValueById(Convert.ToInt32(valueStr));
                            if (pvaValue != null)
                            {
                                pvaAttribute = string.Format("{0}: {1}", pva.ProductAttribute.Name, pvaValue.Name);
                                if (renderPrices)
                                {
                                    decimal priceAdjustmentBase = TaxManager.GetPrice(productVariant, pvaValue.PriceAdjustment, customer);
                                    decimal priceAdjustment     = CurrencyManager.ConvertCurrency(priceAdjustmentBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                                    if (priceAdjustmentBase > 0)
                                    {
                                        string priceAdjustmentStr = PriceHelper.FormatPrice(priceAdjustment, false, false);
                                        pvaAttribute += string.Format(" [+{0}]", priceAdjustmentStr);
                                    }
                                }
                            }
                        }

                        if (!String.IsNullOrEmpty(pvaAttribute))
                        {
                            if (i != 0 || j != 0)
                            {
                                result.Append(serapator);
                            }

                            //we don't encode multiline textbox input
                            if (htmlEncode &&
                                pva.AttributeControlType != AttributeControlTypeEnum.MultilineTextbox)
                            {
                                result.Append(HttpUtility.HtmlEncode(pvaAttribute));
                            }
                            else
                            {
                                result.Append(pvaAttribute);
                            }
                        }
                    }
                }
            }

            //gift cards
            if (renderGiftCardAttributes)
            {
                if (productVariant.IsGiftCard)
                {
                    string giftCardRecipientName  = string.Empty;
                    string giftCardRecipientEmail = string.Empty;
                    string giftCardSenderName     = string.Empty;
                    string giftCardSenderEmail    = string.Empty;
                    string giftCardMessage        = string.Empty;
                    GetGiftCardAttribute(attributes, out giftCardRecipientName, out giftCardRecipientEmail,
                                         out giftCardSenderName, out giftCardSenderEmail, out giftCardMessage);

                    if (!String.IsNullOrEmpty(result.ToString()))
                    {
                        result.Append(serapator);
                    }

                    if (htmlEncode)
                    {
                        result.Append(HttpUtility.HtmlEncode(string.Format(LocalizationManager.GetLocaleResourceString("GiftCardAttribute.For"), giftCardRecipientName)));
                        result.Append(serapator);
                        result.Append(HttpUtility.HtmlEncode(string.Format(LocalizationManager.GetLocaleResourceString("GiftCardAttribute.From"), giftCardSenderName)));
                    }
                    else
                    {
                        result.Append(string.Format(LocalizationManager.GetLocaleResourceString("GiftCardAttribute.For"), giftCardRecipientName));
                        result.Append(serapator);
                        result.Append(string.Format(LocalizationManager.GetLocaleResourceString("GiftCardAttribute.From"), giftCardSenderName));
                    }
                }
            }
            return(result.ToString());
        }
Exemple #8
0
        //将适合过滤条件的库存数据显示在DataGridView中
        void ShowStock()
        {
            //FillGoodsTypeList();		//将选择的类别列表填充完整
            //MessageBox.Show(l_GoodsTypeList.Count.ToString());
            int row = dataGridView1.Rows.Count;            //得到总行数

            for (int i = 0; i < row; i++)
            {
                //MessageBox.Show(dataGridView1.Rows[i].Cells[3].Value.ToString());
                bool   sFlag = true;
                string ts    = dataGridView1.Rows[i].Cells["EndQty"].Value.ToString();
                if (ts == "")
                {
                    ts = "0";
                }
                decimal dt1 = 0.0M;
                if (ts.Contains("E"))
                {
                                    dt1 = Convert.ToDecimal(Decimal.Parse(ts.ToString(), System.Globalization.NumberStyles.Float));
                                     
                }
                else
                {
                    dt1 = Convert.ToDecimal(ts);
                }
                if (dt1 > 0 && !b_DispPositive)
                {
                    sFlag = false;
                    goto DoShow;
                }
                if (dt1 == 0 && !b_DispZeroStock)
                {
                    sFlag = false;
                    goto DoShow;
                }
                if (dt1 < 0 && !b_DispNegative)
                {
                    sFlag = false;
                    goto DoShow;
                }
                int tGID = Convert.ToInt32(dataGridView1.Rows[i].Cells["GoodsID"].Value.ToString());
                //检测货品类别
                int tiTypeID = Convert.ToInt32(dataGridView1.Rows[i].Cells["GoodsTypeID"].Value.ToString());
                if (!l_GoodsTypeList.Contains(tiTypeID))
                {
                    sFlag = false;
                    goto DoShow;
                }
                //检测品名过滤
                string s1 = dataGridView1.Rows[i].Cells["GoodsName"].Value.ToString();
                string s2 = textBoxFindGoods.Text.Trim();
                if (s1.IndexOf(s2) == -1)
                {
                    sFlag = false;
                    goto DoShow;
                }

DoShow:
                CurrencyManager cm = (CurrencyManager)BindingContext[dataGridView1.DataSource];
                cm.SuspendBinding();                //挂起数据绑定
                dataGridView1.Rows[i].Visible = sFlag;
                cm.ResumeBinding();                 //恢复数据绑定
            }
        }
Exemple #9
0
        private void btnCrea_Click(object sender, System.EventArgs e)
        {
            string          dataMember = dgMovSpesa.DataMember;
            CurrencyManager cm         = (CurrencyManager)dgMovSpesa.BindingContext[DS2, dataMember];
            DataView        view       = cm.List as DataView;

            if (view == null)
            {
                MessageBox.Show(this, "Lista vuota!");
                return;
            }
            ArrayList movimenti       = new ArrayList();
            string    filtroMovimenti = "";

            MovimentiElaborati = new Hashtable();

            for (int i = 0; i < view.Count; i++)
            {
                if (dgMovSpesa.IsSelected(i))
                {
                    object idSpesa = view[i]["idexp"];
                    if (movimenti.IndexOf(idSpesa) == -1)
                    {
                        movimenti.Add(idSpesa);
                        filtroMovimenti += ", " + QHS.quote(idSpesa) + "";
                    }
                }
            }

            if (movimenti.Count == 0)
            {
                MessageBox.Show(this, "Nessun movimento di spesa selezionato!");
                return;
            }

            if (filtroMovimenti != "")
            {
                filtroMovimenti = filtroMovimenti.Substring(1);
            }

            foreach (object idSpesa in movimenti)
            {
                creaMovSpesa(idSpesa);
            }


            int fasespesamax = CfgFn.GetNoNullInt32(Meta.GetSys("maxexpensephase"));



            GestioneAutomatismi ga = new GestioneAutomatismi(this, Meta.Conn, Meta.Dispatcher, DS2.Copy(),
                                                             fasespesamax, fasespesamax, "expense", true);

            ga.GeneraClassificazioniAutomatiche(ga.DSP, true);

            bool res = ga.GeneraAutomatismiAfterPost(true);

            if (!res)
            {
                MessageBox.Show(this, "Si è verificato un errore o si è deciso di non salvare! L'operazione sarà terminata");
                Resetta();
                return;
            }

            res = ga.doPost(Meta.Dispatcher);
            if (res)
            {
                ViewAutomatismi(ga.DSP);
            }
            Resetta();
        }
        public void BindData()
        {
            //reward points
            if (OrderManager.RewardPointsEnabled && !this.Cart.IsRecurring)
            {
                int     rewardPointsBalance    = NopContext.Current.User.RewardPointsBalance;
                decimal rewardPointsAmountBase = OrderManager.ConvertRewardPointsToAmount(rewardPointsBalance);
                decimal rewardPointsAmount     = CurrencyManager.ConvertCurrency(rewardPointsAmountBase, CurrencyManager.PrimaryStoreCurrency, NopContext.Current.WorkingCurrency);
                if (rewardPointsAmount > decimal.Zero)
                {
                    string rewardPointsAmountStr = PriceHelper.FormatPrice(rewardPointsAmount, true, false);
                    cbUseRewardPoints.Text  = GetLocaleResourceString("Checkout.UseRewardPoints", rewardPointsBalance, rewardPointsAmountStr);
                    pnlRewardPoints.Visible = true;
                }
                else
                {
                    pnlRewardPoints.Visible = false;
                }
            }
            else
            {
                pnlRewardPoints.Visible = false;
            }

            //payment methods
            int?filterByCountryId = null;

            if (NopContext.Current.User.BillingAddress != null && NopContext.Current.User.BillingAddress.Country != null)
            {
                filterByCountryId = NopContext.Current.User.BillingAddress.CountryId;
            }

            bool hasButtonMethods    = false;
            var  boundPaymentMethods = new PaymentMethodCollection();
            var  paymentMethods      = PaymentMethodManager.GetAllPaymentMethods(filterByCountryId);

            foreach (var pm in paymentMethods)
            {
                switch (pm.PaymentMethodType)
                {
                case PaymentMethodTypeEnum.Unknown:
                case PaymentMethodTypeEnum.Standard:
                {
                    if (!Cart.IsRecurring || PaymentManager.SupportRecurringPayments(pm.PaymentMethodId) != RecurringPaymentTypeEnum.NotSupported)
                    {
                        boundPaymentMethods.Add(pm);
                    }
                }
                break;

                case PaymentMethodTypeEnum.Button:
                {
                    //PayPal Express is placed here as button
                    if (pm.SystemKeyword == "PayPalExpress")
                    {
                        if (!Cart.IsRecurring || PaymentManager.SupportRecurringPayments(pm.PaymentMethodId) != RecurringPaymentTypeEnum.NotSupported)
                        {
                            hasButtonMethods = true;
                        }
                    }
                }
                break;

                default:
                    break;
                }
            }

            if (boundPaymentMethods.Count == 0)
            {
                if (hasButtonMethods)
                {
                    phSelectPaymentMethod.Visible  = false;
                    pnlPaymentMethodsError.Visible = false;

                    //no reward points in this case
                    pnlRewardPoints.Visible = false;
                }
                else
                {
                    phSelectPaymentMethod.Visible  = false;
                    pnlPaymentMethodsError.Visible = true;
                    lPaymentMethodsError.Text      = GetLocaleResourceString("Checkout.NoPaymentMethods");

                    //no reward points in this case
                    pnlRewardPoints.Visible = false;
                }
            }
            else if (boundPaymentMethods.Count == 1)
            {
                phSelectPaymentMethod.Visible  = true;
                pnlPaymentMethodsError.Visible = false;
                dlPaymentMethod.DataSource     = boundPaymentMethods;
                dlPaymentMethod.DataBind();
            }
            else
            {
                phSelectPaymentMethod.Visible  = true;
                pnlPaymentMethodsError.Visible = false;
                dlPaymentMethod.DataSource     = boundPaymentMethods;
                dlPaymentMethod.DataBind();
            }
        }
Exemple #11
0
        protected override void Paint(Graphics g, Rectangle Bounds, CurrencyManager Source, int RowNum, Brush BackBrush, Brush ForeBrush, bool AlignToRight)
        {
            string Text = GetText(GetColumnValueAtRow(Source, RowNum));

            PaintText(g, Bounds, Text, BackBrush, ForeBrush, AlignToRight);
        }
Exemple #12
0
        private void AddGridTableStyle()
        {
            int IntAvgCharWidth;

            ts = new DataGridTableStyle();
            IntAvgCharWidth = (int)(System.Drawing.Graphics.FromHwnd(this.Handle).MeasureString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", this.Font).Width / 26);
            objStudentCM    = (System.Windows.Forms.CurrencyManager) this.BindingContext[ds.Tables[0]];
            ts.MappingName  = ds.Tables[0].TableName;

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.ReadOnly             = false;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["mabn"]));
            ts.GridColumnStyles[0].MappingName = "mabn";
            ts.GridColumnStyles[0].HeaderText  = "Mã BN";
            ts.GridColumnStyles[0].Width       = 60;
            ts.ReadOnly = true;
            ts.GridColumnStyles[0].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[0].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["sovaovien"]));
            ts.GridColumnStyles[1].MappingName = "sovaovien";
            ts.GridColumnStyles[1].HeaderText  = "STT";
            ts.GridColumnStyles[1].Width       = 40;
            ts.ReadOnly = true;
            ts.GridColumnStyles[1].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[1].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["hoten"]));
            ts.GridColumnStyles[2].MappingName = "hoten";
            ts.GridColumnStyles[2].HeaderText  = "Họ và tên";
            ts.GridColumnStyles[2].Width       = 180;
            ts.ReadOnly = true;
            ts.GridColumnStyles[2].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[2].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["namsinh"]));
            ts.GridColumnStyles[3].MappingName = "namsinh";
            ts.GridColumnStyles[3].HeaderText  = "NS";
            ts.GridColumnStyles[3].Width       = 35;
            ts.ReadOnly = true;
            ts.GridColumnStyles[3].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[3].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["diachi"]));
            ts.GridColumnStyles[4].MappingName = "diachi";
            ts.GridColumnStyles[4].HeaderText  = "Địa chỉ";
            ts.GridColumnStyles[4].Width       = 170;
            ts.ReadOnly = true;
            ts.GridColumnStyles[4].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[4].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["tenkpcu"]));
            ts.GridColumnStyles[5].MappingName = "tenkpcu";
            ts.GridColumnStyles[5].HeaderText  = "Phòng khám";
            ts.GridColumnStyles[5].Width       = 100;
            ts.ReadOnly = true;
            ts.GridColumnStyles[5].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[5].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridComboBoxColumn(dt, "tenkp", "tenkp"));
            ts.GridColumnStyles[6].MappingName = "tenkp";
            ts.GridColumnStyles[6].HeaderText  = "Chuyển phòng";
            ts.GridColumnStyles[6].Width       = 160;
            ts.GridColumnStyles[6].Alignment   = HorizontalAlignment.Left;
            ts.GridColumnStyles[6].NullText    = string.Empty;
            dataGrid1.CaptionText = string.Empty;

            dataGrid1.DataSource = ds;
            dataGrid1.DataMember = ds.Tables[0].TableName;
            dataGrid1.TableStyles.Add(ts);
        }
        /// <summary>
        ///
        /// </summary>
        public override string ParseGridAndCreateJavascriptData(DataGridView dataGridCurrent, string sJsDataTemplate, Form cMainForm, TabControl tabData)
        {
            string sReturnJavascript = sJsDataTemplate;

            if (dataGridCurrent.DataSource != null)
            {
                int iQuestionsCount = 0;
                int iChoicesCount   = 0;

                string[][] sFinalQuestions = new string[500][];
                string[]   sFinalAnswers   = new string[500];
                string[][] sFinalFeedback  = new string[500][];

                CurrencyManager cm = (CurrencyManager)cMainForm.BindingContext[dataGridCurrent.DataSource];

                int iChoice = 1;
                for (int row = 0; row < cm.Count; row += iChoice)
                {
                    string   sQuestion = dataGridCurrent[0, row].Value.ToString();
                    string   sAnswer   = dataGridCurrent[3, row].Value.ToString();
                    string[] sChoices  = new string[4];
                    string[] sFeedback = new string[4];
                    sChoices[0]  = dataGridCurrent[1, row].Value.ToString();
                    sFeedback[0] = dataGridCurrent[2, row].Value.ToString();
                    string sNextQuestion = "";
                    for (iChoice = 1; (sNextQuestion.Length <= 0) && ((row + iChoice) < cm.Count); iChoice++)
                    {
                        string sLookAhead = dataGridCurrent[0, row + iChoice].Value.ToString();
                        if (sLookAhead.Length <= 0)
                        {
                            sChoices[iChoice]  = dataGridCurrent[1, row + iChoice].Value.ToString();
                            sFeedback[iChoice] = dataGridCurrent[2, row + iChoice].Value.ToString();
                        }
                        else
                        {
                            sNextQuestion = sLookAhead;
                            // if this for loop breaks out from (row + iChoice) < cm.Count
                            // then we are at end of entire list
                            // so we need to subtract 1 from iChoice whenever that's not the case
                            // ---- ONLY SUBTRACT 1 WHEN NOT ON LAST QUESTION
                            iChoice--;
                        }
                    }

                    int iCurrentChoicesCount = iChoice;

                    if ((sQuestion.Length > 0) && (sAnswer.Length > 0) && (iCurrentChoicesCount > 0))
                    {
                        sAnswer = sAnswer.ToLower().Substring(0, 1);
                        int iCorrectIndex = sAnswer[0] - 'a';
                        if ((iCorrectIndex < 4) && (sChoices[iCorrectIndex].Length > 0))
                        {
                            sFinalQuestions[iQuestionsCount]    = new string[5];
                            sFinalQuestions[iQuestionsCount][0] = sQuestion;
                            sFinalQuestions[iQuestionsCount][1] = sChoices[0];
                            sFinalQuestions[iQuestionsCount][2] = sChoices[1];
                            sFinalQuestions[iQuestionsCount][3] = sChoices[2];
                            sFinalQuestions[iQuestionsCount][4] = sChoices[3];
                            sFinalAnswers  [iQuestionsCount]    = sChoices[iCorrectIndex];
                            sFinalFeedback [iQuestionsCount]    = new string[4];
                            sFinalFeedback [iQuestionsCount][0] = sFeedback[0];
                            sFinalFeedback [iQuestionsCount][1] = sFeedback[1];
                            sFinalFeedback [iQuestionsCount][2] = sFeedback[2];
                            sFinalFeedback [iQuestionsCount][3] = sFeedback[3];

                            iQuestionsCount++;

                            if (iCurrentChoicesCount > iChoicesCount)
                            {
                                iChoicesCount = iCurrentChoicesCount;
                            }
                        }
                    }
                }

                string sNewSizeVars = "numQues=" + iQuestionsCount + ";\r\n"
                                      + "numChoi=" + iChoicesCount + ";";

                sReturnJavascript = Regex.Replace(sReturnJavascript,
                                                  "//SIZEVARSBEGIN(.*)//SIZEVARSEND",
                                                  "//SIZEVARSBEGIN\r\n" + sNewSizeVars + "\r\n//SIZEVARSEND",
                                                  RegexOptions.Singleline);

                string sMatchingQuestionsLine = "\r\nquestions[NNN][OOO]=\"QQQ\";";
                string sMatchingAnswersLine   = "\r\nanswers[NNN]=\"AAA\";";
                string sMatchingFeedbackLine  = "\r\nfeedback[NNN][PPP]=\"FFF\";";
                string sQuestionLines         = "";
                string sAnswerLines           = "";
                string sFeedbackLines         = "";

                for (int row = 0; row < iQuestionsCount; row++)
                {
                    for (int i = 0; i < 5; i++)
                    {
                        string sTempQuestionsLine = sMatchingQuestionsLine;
                        sTempQuestionsLine = sTempQuestionsLine.Replace("NNN", row.ToString());
                        sTempQuestionsLine = sTempQuestionsLine.Replace("OOO", i.ToString());
                        if (sFinalQuestions[row][i] != null)
                        {
                            sFinalQuestions[row][i] = sFinalQuestions[row][i].Replace("\"", "&quot;");
                        }
                        sTempQuestionsLine = sTempQuestionsLine.Replace("QQQ", sFinalQuestions[row][i]);
                        sQuestionLines     = sQuestionLines + sTempQuestionsLine;
                    }

                    string sTempAnswersLine = sMatchingAnswersLine;
                    sTempAnswersLine   = sTempAnswersLine.Replace("NNN", row.ToString());
                    sFinalAnswers[row] = sFinalAnswers[row].Replace("\"", "&quot;");
                    sTempAnswersLine   = sTempAnswersLine.Replace("AAA", sFinalAnswers[row]);

                    sAnswerLines = sAnswerLines + sTempAnswersLine;

                    for (int i = 0; i < 4; i++)
                    {
                        string sTempFeedbackLine = sMatchingFeedbackLine;
                        sTempFeedbackLine = sTempFeedbackLine.Replace("NNN", row.ToString());
                        sTempFeedbackLine = sTempFeedbackLine.Replace("PPP", i.ToString());
                        if (sFinalFeedback[row][i] != null)
                        {
                            //sFinalFeedback[row][i] = sFinalFeedback[row][i].Replace("\"", "&quot;");
                            // Actually for some odd reason (because it's not displayed in html, but in the alert and input text box?)...
                            //...Feedback needs to be opposite of the others
                            sFinalFeedback[row][i] = sFinalFeedback[row][i].Replace("&quot;", "\\\"");
                        }
                        sTempFeedbackLine = sTempFeedbackLine.Replace("FFF", sFinalFeedback[row][i]);
                        sFeedbackLines    = sFeedbackLines + sTempFeedbackLine;
                    }
                }

                sReturnJavascript = Regex.Replace(sReturnJavascript,
                                                  "//QUESTIONSBEGIN(.*)//QUESTIONSEND",
                                                  "//QUESTIONSBEGIN" + sQuestionLines + "\r\n//QUESTIONSEND",
                                                  RegexOptions.Singleline);

                sReturnJavascript = Regex.Replace(sReturnJavascript,
                                                  "//ANSWERSBEGIN(.*)//ANSWERSEND",
                                                  "//ANSWERSBEGIN" + sAnswerLines + "\r\n//ANSWERSEND",
                                                  RegexOptions.Singleline);

                sReturnJavascript = Regex.Replace(sReturnJavascript,
                                                  "//FEEDBACKBEGIN(.*)//FEEDBACKEND",
                                                  "//FEEDBACKBEGIN" + sFeedbackLines + "\r\n//FEEDBACKEND",
                                                  RegexOptions.Singleline);

                Control.ControlCollection ocTabPageJsOptions = tabData.Controls.Find("tabPageJsOptionsMc", false)[0].Controls;
                string sCheckAnswersButton       = ((CheckBox)ocTabPageJsOptions.Find("checkBoxMcCheckAnswersButton", false)[0]).Checked ? "true" : "false";
                string sFeedbackDisplayInResults = ((CheckBox)ocTabPageJsOptions.Find("checkBoxMcFeedbackInResults", false)[0]).Checked ? "true" : "false";
                string sFeedbackDisplayInPopup   = ((CheckBox)ocTabPageJsOptions.Find("checkBoxMcFeedbackInPopup", false)[0]).Checked ? "true" : "false";
                string sOnePerPage = "false";
                if (((RadioButton)ocTabPageJsOptions.Find("radioButtonMcQuestionOne", false)[0]).Checked)
                {
                    sOnePerPage = "true";
                }
                string sNumCols = ((TextBox)ocTabPageJsOptions.Find("textBoxMtResultsCols", false)[0]).Text;
                string sNumRows = ((TextBox)ocTabPageJsOptions.Find("textBoxMtResultsRows", false)[0]).Text;


                sReturnJavascript += "\r\niResultsWidth=" + sNumCols + ";\r\n";
                sReturnJavascript += "\r\niResultsHeight=" + sNumRows + ";\r\n";
                sReturnJavascript += "\r\nbOnePerPage=" + sOnePerPage + ";\r\n";
                sReturnJavascript += "\r\nbFeedbackDisplayInPopup=" + sFeedbackDisplayInPopup + ";\r\n";
                sReturnJavascript += "\r\nbFeedbackDisplayInResults=" + sFeedbackDisplayInResults + ";\r\n";
                sReturnJavascript += "\r\nbCheckAnswersButton=" + sCheckAnswersButton + ";\r\n";
            }
            return(sReturnJavascript);
        }
Exemple #14
0
        /// <summary>
        /// Method for load messages.
        /// </summary>
        /// <param name="messageListType">The Message List Type.</param>
        public void LoadMessages(MessageListType messageListType)
        {
            Facade facade         = Facade.GetInstance();
            string selectedFolder = string.Empty;

            if (messageListType == MessageListType.Inbox ||
                messageListType == MessageListType.Unread ||
                messageListType == MessageListType.Read)
            {
                // Attach to Message Store
                this._store = facade.GetMessageStore();
            }
            else if (messageListType == MessageListType.SentItems)
            {
                // Attach to Message Store Sent items
                this._store = facade.GetMessageStoreSent();
            }
            else if (messageListType == MessageListType.DeletedItems)
            {
                // Attach to Message Store Sent items
                this._store = facade.GetMessageStoreDelete();
            }
            else if (messageListType == MessageListType.Custom)
            {
                // Attach to Message Store Sent items
                this._store    = facade.GetMessageStoreCustom();
                selectedFolder = MainForm.GetInstance().GetSelectedFolder();
            }
            else
            {
                this._store = new MessageStore();
            }

            // Reset DataSource
            this.messageBS.DataSource    = this._store.Messages;
            this.dataGridView.DataSource = this.messageBS;

            this.dataGridView.CurrentCell = null;

            CurrencyManager cm = (CurrencyManager)this.dataGridView.BindingContext[this.dataGridView.DataSource];

            cm.SuspendBinding();

            foreach (DataGridViewRow row in this.dataGridView.Rows)
            {
                MailMessage mailMessage = (MailMessage)row.DataBoundItem;

                if (messageListType == MessageListType.Unread && mailMessage.Read)
                {
                    row.Visible = false;
                }
                else if (messageListType == MessageListType.Read && !mailMessage.Read)
                {
                    row.Visible = false;
                }
                else if (messageListType == MessageListType.Custom &&
                         !mailMessage.ParentFolder.Equals(selectedFolder))
                {
                    row.Visible = false;
                }
                else
                {
                    row.Visible = true;
                }
            }

            cm.ResumeBinding();

            if (this.messageBS.Count > 0)
            {
                this.dataGridView.Sort(this.dataGridView.Columns[2], ListSortDirection.Descending);
            }

            MainForm mainForm = this.ParentForm as MainForm;

            mainForm.LoadSelectedMessage(this._store);

            this.Invalidate(true);
        }
Exemple #15
0
 public void BeforeYearlyExecute(int currentYear)
 {
     _personsPerRoomByZone = new Dictionary <int, float>();
     _currencyManager      = Repository.GetRepository(CurrencyManager);
 }
Exemple #16
0
 public VaryByCurrency(CurrencyManager currencyManager)
 {
     CurrencyManager = currencyManager;
 }
Exemple #17
0
 protected override void Edit(CurrencyManager Source, int Rownum, Rectangle Bounds, bool ReadOnly, string InstantText, bool CellIsVisible)
 {
 }
Exemple #18
0
 protected override bool Commit(CurrencyManager DataSource, int RowNum)
 {
     return(true);
 }
Exemple #19
0
        private void AddGridTableStyle1()
        {
            int IntAvgCharWidth;

            ts = new DataGridTableStyle();
            IntAvgCharWidth = (int)(System.Drawing.Graphics.FromHwnd(this.Handle).MeasureString("ABCDEFGHIJKLMNOPQRSTUVWXYZ", this.Font).Width / 26);
            objStudentCM    = (System.Windows.Forms.CurrencyManager) this.BindingContext[ds.Tables[0]];
            ts.MappingName  = ds.Tables[0].TableName;

            ts.AlternatingBackColor = Color.Beige;
            ts.BackColor            = Color.GhostWhite;
            ts.ForeColor            = Color.MidnightBlue;
            ts.GridLineColor        = Color.RoyalBlue;
            ts.HeaderBackColor      = Color.MidnightBlue;
            ts.HeaderForeColor      = Color.Lavender;
            ts.SelectionBackColor   = Color.Teal;
            ts.SelectionForeColor   = Color.PaleGreen;
            ts.RowHeaderWidth       = 10;
            ts.ReadOnly             = false;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["mabd"]));
            ts.GridColumnStyles[0].MappingName = "mabd";
            ts.GridColumnStyles[0].HeaderText  = "";
            ts.GridColumnStyles[0].Width       = 0;
            ts.ReadOnly = true;
            ts.GridColumnStyles[0].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[0].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridComboBoxColumn(dtnguon, 1, 1));
            ts.GridColumnStyles[1].MappingName = "nguon";
            ts.GridColumnStyles[1].HeaderText  = "Nguồn";
            ts.GridColumnStyles[1].Width       = 140;
            ts.GridColumnStyles[1].Alignment   = HorizontalAlignment.Left;
            ts.GridColumnStyles[1].NullText    = string.Empty;
            dataGrid2.CaptionText = string.Empty;

            ts.GridColumnStyles.Add(new DataGridComboBoxColumn(dtdt, 1, 1));
            ts.GridColumnStyles[2].MappingName = "doituong";
            ts.GridColumnStyles[2].HeaderText  = "Đối tượng";
            ts.GridColumnStyles[2].Width       = 80;
            ts.GridColumnStyles[2].Alignment   = HorizontalAlignment.Left;
            ts.GridColumnStyles[2].NullText    = string.Empty;
            dataGrid2.CaptionText = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["ten"]));
            ts.GridColumnStyles[3].MappingName = "ten";
            ts.GridColumnStyles[3].HeaderText  = "Tên thuốc";
            ts.GridColumnStyles[3].Width       = 270;
            ts.ReadOnly = true;
            ts.GridColumnStyles[3].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[3].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["dang"]));
            ts.GridColumnStyles[4].MappingName = "dang";
            ts.GridColumnStyles[4].HeaderText  = "ĐVT";
            ts.GridColumnStyles[4].Width       = 60;
            ts.ReadOnly = true;
            ts.GridColumnStyles[4].Alignment = HorizontalAlignment.Left;
            ts.GridColumnStyles[4].NullText  = string.Empty;

            ts.GridColumnStyles.Add(new DataGridTextBoxColumn(objStudentCM.GetItemProperties()["soluong"]));
            ts.GridColumnStyles[5].MappingName = "soluong";
            ts.GridColumnStyles[5].HeaderText  = "Số lượng";
            ts.GridColumnStyles[5].Width       = 50;
            ts.ReadOnly = false;
            ts.GridColumnStyles[5].Alignment = HorizontalAlignment.Right;
            ts.GridColumnStyles[5].NullText  = string.Empty;

            dataGrid2.DataSource = ds;
            dataGrid2.DataMember = ds.Tables[0].TableName;
            dataGrid2.TableStyles.Add(ts);
        }
Exemple #20
0
 protected override void Paint(Graphics g, Rectangle Bounds, CurrencyManager Source, int RowNum)
 {
     Paint(g, Bounds, Source, RowNum, false);
 }
Exemple #21
0
 public PORVForm(string[] xml, string skuid, string errinfo, string[] retried, DataTable dtmaterial, string[][] check)
 {
     InitializeComponent();
     Xml     = xml;
     Retried = retried;
     Check   = check;
     dt      = DBhelp.XML2Table(Xml[0]);
     cm      = (CurrencyManager)this.BindingContext[dt];
     textEdit1.DataBindings.Add("Text", dt, "AgencyLeaf");
     textEdit2.DataBindings.Add("Text", dt, "SysLogID");
     textEdit3.DataBindings.Add("Text", dt, "StationID");
     textEdit4.DataBindings.Add("Text", dt, "RoleLeaf");
     textEdit5.DataBindings.Add("Text", dt, "CommunityID");
     textEdit6.DataBindings.Add("Text", dt, "UserCode");
     textEdit7.DataBindings.Add("Text", dt, "ExCode");
     textEdit8.DataBindings.Add("Text", dt, "UserID");
     textEdit9.DataBindings.Add("Text", dt, "PassWord");
     textEdit10.DataBindings.Add("Text", dt, "PONumber");
     textEdit11.DataBindings.Add("Text", dt, "POLineNumber");
     textEdit12.DataBindings.Add("Text", dt, "POReceiptActionType");
     textEdit13.DataBindings.Add("Text", dt, "POLineUM");
     textEdit14.DataBindings.Add("Text", dt, "ReceiptQuantityMove1");
     textEdit15.DataBindings.Add("Text", dt, "Stockroom1");
     textEdit16.DataBindings.Add("Text", dt, "Bin1");
     textEdit17.DataBindings.Add("Text", dt, "InventoryCategory1");
     textEdit18.DataBindings.Add("Text", dt, "POLineType");
     textEdit19.DataBindings.Add("Text", dt, "ItemNumber");
     textEdit20.DataBindings.Add("Text", dt, "NewLot");
     textEdit21.DataBindings.Add("Text", dt, "LotNumberAssignmentPolicy");
     textEdit22.DataBindings.Add("Text", dt, "LotNumberDefault");
     if (dt.Columns.Contains("VendorLotNumber"))
     {
         textEdit23.DataBindings.Add("Text", dt, "VendorLotNumber");
     }
     else
     {
         textEdit23.Text = "";
     }
     if (dt.Columns.Contains("FirstReceiptDate"))
     {
         textEdit24.DataBindings.Add("Text", dt, "FirstReceiptDate");
     }
     else
     {
         textEdit24.Text = "";
     }
     textEdit25.DataBindings.Add("Text", dt, "PromisedDate");
     textEdit26.DataBindings.Add("Text", dt, "POReceiptDate");
     textEdit27.Text = skuid;
     cm.Position     = 0; // 如 index = 0;
     if (dtmaterial != null)
     {
         textEdit28.DataBindings.Add("Text", dtmaterial, "LotNumber");
         textEdit29.DataBindings.Add("Text", dtmaterial, "RecvBatchNo");
         textEdit30.DataBindings.Add("Text", dtmaterial, "MaterialTrackID");
         textEdit31.DataBindings.Add("Text", dtmaterial, "QtyInStore");
         check[0][1] = check[0][2] = dtmaterial.Rows[0]["RecvBatchNo"].ToString();
         check[1][1] = check[1][2] = dtmaterial.Rows[0]["QtyInStore"].ToString();
     }
     else
     {
         this.checkEdit2.Enabled = false;
         this.checkEdit3.Enabled = false;
     }
     if (errinfo.Trim() != "")
     {
         this.textBox1.WordWrap = true;
         this.textBox1.Text     = errinfo;
     }
     if (Retried[0] == "True")
     {
         this.checkEdit1.Checked    = true;
         this.simpleButton1.Enabled = false;
         this.btn_delete.Enabled    = false;
     }
     else
     {
         this.checkEdit1.Checked = false;
     }
 }
Exemple #22
0
        private void loadThongTin()
        {
            LapHoaDonDTO a = new LapHoaDonDTO();

            a.Mapk = int.Parse(cmbMaPhieuKham.Text);
            if (lhdBus.KtMaPK(a) == null)
            {
                MessageBox.Show("Không tồn tại mã phiếu khám", "error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (lhdBus.loadThongTin(a) == null)
            {
                MessageBox.Show("Không có thông tin", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                txtTenBenhNhan.Text = lhdBus.loadThongTin(a).Tenbn;
            }

            if (lhdBus.loadCTTT(a) == null)
            {
                MessageBox.Show("Không có chi tiết toa thuốc!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Information);
                this.dgvThongTinChiTiet.Columns.Clear();
            }
            else
            {
                this.dgvThongTinChiTiet.Columns.Clear();
                this.dgvThongTinChiTiet.DataSource          = null;
                this.dgvThongTinChiTiet.AutoGenerateColumns = false;
                this.dgvThongTinChiTiet.AllowUserToAddRows  = false;

                dgvThongTinChiTiet.DataSource = lhdBus.loadCTTT(a);
                DataGridViewTextBoxColumn tenthuocCol = new DataGridViewTextBoxColumn();
                tenthuocCol.Name             = "TenThuoc";
                tenthuocCol.HeaderText       = "Tên thuốc";
                tenthuocCol.DataPropertyName = "TenThuoc";
                tenthuocCol.Width            = 200;
                this.dgvThongTinChiTiet.Columns.Add(tenthuocCol);

                DataGridViewTextBoxColumn soluongCol = new DataGridViewTextBoxColumn();
                soluongCol.Name             = "SoLuong";
                soluongCol.HeaderText       = "Số lượng";
                soluongCol.DataPropertyName = "SoLuong";
                soluongCol.Width            = 200;
                this.dgvThongTinChiTiet.Columns.Add(soluongCol);

                DataGridViewTextBoxColumn donvitinhCol = new DataGridViewTextBoxColumn();
                donvitinhCol.Name             = "DonViTinh";
                donvitinhCol.HeaderText       = "Đơn vị tính";
                donvitinhCol.DataPropertyName = "DonViTinh";
                donvitinhCol.Width            = 200;
                this.dgvThongTinChiTiet.Columns.Add(donvitinhCol);

                DataGridViewTextBoxColumn dongiaCol = new DataGridViewTextBoxColumn();
                dongiaCol.Name             = "DonGia";
                dongiaCol.HeaderText       = "Đơn giá";
                dongiaCol.DataPropertyName = "DonGia";
                dongiaCol.Width            = 200;
                this.dgvThongTinChiTiet.Columns.Add(dongiaCol);

                CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[this.dgvThongTinChiTiet.DataSource];
                myCurrencyManager.Refresh();

                txtChiPhiThuoc.Text = lhdBus.TinhTienThuoc(a).Chiphithuoc.ToString();
                txtTongTien.Text    = (float.Parse(txtChiPhiThuoc.Text) + float.Parse(txtChiPhiKham.Text)).ToString();
            }
        }
Exemple #23
0
    private void RefreshGrid(object dataSource)
    {
        CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[dataSource];

        myCurrencyManager.Refresh();
    }
Exemple #24
0
        // ** utilities

        // update filter (called after editing the filter row)
        private void UpdateFilter()
        {
            // make sure we have a filter row
            if (_row < 0)
            {
                return;
            }

            // make sure we have a data view
            DataView dv = _flex.DataSource as DataView;

            if (dv == null)
            {
                DataTable dt = _flex.DataSource as DataTable;
                if (dt != null)
                {
                    dv = dt.DefaultView;
                }
            }
            if (dv == null)
            {
                return;
            }

            CurrencyManager cm = (CurrencyManager)_flex.BindingContext[_flex.DataSource, _flex.DataMember];

            cm.EndCurrentEdit();

            // scan each cell in the filter row and build new filter
            StringBuilder sb = new StringBuilder();

            for (int col = _flex.Cols.Fixed; col < _flex.Cols.Count; col++)
            {
                // get column value
                string expr = string.Empty;
                if (_flex.Col == col && _flex.Editor != null)
                {
                    expr = _flex.Editor.Text.TrimEnd();
                }
                else
                {
                    expr = _flex.GetDataDisplay(_row, col).TrimEnd();
                }

                if (_flex.Cols[col].DataType == typeof(bool))
                {
                    switch (_flex.GetCellCheck(_row, col))
                    {
                    case CheckEnum.TSChecked:
                        expr = "true";
                        break;

                    case CheckEnum.TSUnchecked:
                        expr = "false";
                        break;
                    }
                }

                // ignore empty cells
                if (expr.Length == 0)
                {
                    continue;
                }

                IDictionary dataMap = _flex.Cols[col].DataMap;
                if (dataMap != null)
                {
                    foreach (object key in dataMap.Keys)
                    {
                        if (string.Compare(dataMap[key].ToString(), expr, true) == 0)
                        {
                            expr = key.ToString();
                            break;
                        }
                    }
                }

                // get filter expression
                expr = "%" + expr;
                expr = BuildFilterExpression(col, expr);
                if (expr.Length == 0)
                {
                    continue;
                }

                // concatenate new condition
                if (sb.Length > 0)
                {
                    sb.Append(" And ");
                }
                sb.AppendFormat("[{0}]{1}", _flex.Cols[col].Name, expr);
            }

            // apply filter to current view
            string strFilter = sb.ToString();

            if (strFilter == dv.RowFilter)
            {
                return;
            }
            try
            {
                _flex[_row, 0] = null;
                dynamic editor = _flex.Editor;
                _editorSelectionStart  = editor.SelectionStart;
                _editorSelectionLength = editor.SelectionLength;
                dv.RowFilter           = strFilter;
            }
            catch
            {
                _flex[_row, 0] = "Err";
            }

            // stay in filter row
            _flex.Row = _row;
        }
Exemple #25
0
 public PriceCommands(CurrencyManager currencyManager, ILogger logger)
 {
     this._currencyManager = currencyManager;
     this._logger          = logger;
 }
        // Given a row and a display member, iterating over bound datasource to find
        // the associated value member.  Set this value member.
        protected override void SetColumnValueAtRow(CurrencyManager source, int rowNum, object value)
        {
            object s = value;

            // Iterate through the datasource bound to the ColumnComboBox
            // Don't confuse this datasource with the datasource of the associated datagrid
            CurrencyManager cm = (CurrencyManager)
                                 (this.DataGridTableStyle.DataGrid.BindingContext[this.comboBox.DataSource]);

            // Assumes the associated DataGrid is bound to a DataView, or DataTable that
            // implements a default DataView
            if (cm.List.GetType() == typeof(DataView))
            {
                DataView dataview = ((DataView)cm.List);
                int      i;

                for (i = 0; i < dataview.Count; i++)
                {
                    if (s.Equals(dataview[i][this.comboBox.DisplayMember]))
                    {
                        break;
                    }
                }

                // If set item was found return corresponding value, otherwise return DbNull.Value
                if (i < dataview.Count)
                {
                    s = dataview[i][this.comboBox.ValueMember];
                }
                else
                {
                    s = DBNull.Value;
                }
            }
            else if (cm.List.GetType() == typeof(ArrayList))
            {
                ArrayList array = (ArrayList)cm.List;
                int       i;
                for (i = 0; i < array.Count; i++)
                {
                    if ((string)s == ((DataBind)array[i]).Text)
                    {
                        break;
                    }
                }

                if (i < array.Count)
                {
                    s = ((DataBind)array[i]).Index;
                }
                else
                {
                    s = DBNull.Value;
                }
            }
            else
            {
                s = DBNull.Value;
            }

            if (source.Position == rowNum)
            {
                base.SetColumnValueAtRow(source, rowNum, s);
            }
        }
 /// <summary>method: BindControls
 /// Binding context for the currency managers
 /// </summary>
 public void BindControls()
 {
     cmCase         = (CurrencyManager)this.BindingContext[DM.dsBigEye, "T_Case"];
     cmClient       = (CurrencyManager)this.BindingContext[DM.dsBigEye, "T_Client"];
     cmInvestigator = (CurrencyManager)this.BindingContext[DM.dsBigEye, "T_Investigator"];
 }
        private void loadData_Vao_GridView(List <DocGiaDTO> listDocGia)
        {
            if (listDocGia == null)
            {
                MessageBox.Show("Có lỗi khi lấy dữ liệu từ DB");
                return;
            }

            dgv_QuanLyTheDocGia.Columns.Clear();
            dgv_QuanLyTheDocGia.DataSource = null;

            dgv_QuanLyTheDocGia.AutoGenerateColumns = false;
            dgv_QuanLyTheDocGia.AllowUserToAddRows  = false;
            dgv_QuanLyTheDocGia.DataSource          = listDocGia;



            DataGridViewTextBoxColumn clMa = new DataGridViewTextBoxColumn();

            clMa.Name             = "maDocGia";
            clMa.HeaderText       = "Mã độc giả";
            clMa.DataPropertyName = "Ma";
            dgv_QuanLyTheDocGia.Columns.Add(clMa);

            DataGridViewTextBoxColumn clTen = new DataGridViewTextBoxColumn();

            clTen.Name             = "hoVaTenDocGia";
            clTen.HeaderText       = "Tên độc giả";
            clTen.DataPropertyName = "HoVaTen";
            dgv_QuanLyTheDocGia.Columns.Add(clTen);



            DataGridViewTextBoxColumn clNgaySinh = new DataGridViewTextBoxColumn();

            clNgaySinh.DefaultCellStyle.Format = "dd/MM/yyyy";
            clNgaySinh.Name             = "NgaySinh";
            clNgaySinh.HeaderText       = "Ngày sinh";
            clNgaySinh.DataPropertyName = "NgaySinh";
            dgv_QuanLyTheDocGia.Columns.Add(clNgaySinh);


            DataGridViewTextBoxColumn clDiaChi = new DataGridViewTextBoxColumn();

            clDiaChi.Name             = "DiaChi";
            clDiaChi.HeaderText       = "Địa chỉ";
            clDiaChi.DataPropertyName = "DiaChi";
            dgv_QuanLyTheDocGia.Columns.Add(clDiaChi);

            DataGridViewTextBoxColumn clEmail = new DataGridViewTextBoxColumn();

            clEmail.Name             = "email";
            clEmail.HeaderText       = "Email";
            clEmail.DataPropertyName = "email";
            dgv_QuanLyTheDocGia.Columns.Add(clEmail);


            DataGridViewTextBoxColumn clTenLoaiDocGia = new DataGridViewTextBoxColumn();

            clTenLoaiDocGia.Name             = "maLoaiDocGia";
            clTenLoaiDocGia.HeaderText       = "Loại độc giả";
            clTenLoaiDocGia.DataPropertyName = "TenLoaiDocGia";
            dgv_QuanLyTheDocGia.Columns.Add(clTenLoaiDocGia);


            DataGridViewTextBoxColumn clNgayLapThe = new DataGridViewTextBoxColumn();

            clNgayLapThe.DefaultCellStyle.Format = "dd/MM/yyyy";
            clNgayLapThe.Name             = "NgayLapThe";
            clNgayLapThe.HeaderText       = "Ngày lập thẻ";
            clNgayLapThe.DataPropertyName = "NgayLapThe";
            dgv_QuanLyTheDocGia.Columns.Add(clNgayLapThe);


            DataGridViewTextBoxColumn clHanSuDung = new DataGridViewTextBoxColumn();

            clHanSuDung.Name             = "HanSuDung";
            clHanSuDung.HeaderText       = "Hạn sử dụng";
            clHanSuDung.DataPropertyName = "HanSuDung";
            dgv_QuanLyTheDocGia.Columns.Add(clHanSuDung);

            CurrencyManager myCurrencyManager = (CurrencyManager)this.BindingContext[dgv_QuanLyTheDocGia.DataSource];

            myCurrencyManager.Refresh();
        }
Exemple #29
0
 // Use this for initialization
 void Start()
 {
     currencyManager = GameObject.Find("CurrencyManager").GetComponent <CurrencyManager>();
     moneyText       = GetComponent <Text>();
     moneyText.text  = currencyManager.money.ToString();
 }
        Type GetFinalType(CurrencyManager cm)
        {
            FieldInfo fi = cm.GetType().GetField("finalType", BindingFlags.NonPublic | BindingFlags.Instance);

            return((Type)fi.GetValue(cm));
        }
Exemple #31
0
		protected override object GetColumnValueAtRow (CurrencyManager cm, int RowNum)
		{
			/*
			 * Get data from the underlying record and format for display.
			 */
			object oVal = base.GetColumnValueAtRow(cm, RowNum);

			if (oVal is DBNull) {
				return ""; /* String to display for DBNull. */
			}
			else {
				/* CDec on next statement will throw an exception if this
				   column style is bound to a column containing non-numeric data. */
				Decimal Temp = (Decimal)oVal;
				if (Temp >= 0)
					return Temp.ToString ("0.00");
				else
					return (-Temp).ToString("0.00") + "CR";
			}
		}
Exemple #32
0
 private void MoveFirst(CurrencyManager myCurrencyManager)
 {
     myCurrencyManager.Position = 0;
 }
Exemple #33
0
 private void butLuu_Click(object sender, EventArgs e)
 {
     try
     {
         int             n = 0, n1 = 0;
         CurrencyManager cm = (CurrencyManager)BindingContext[dtgvGiavp.DataSource, dtgvGiavp.DataMember];
         DataView        dv = (DataView)cm.List;
         n  = dv.Table.Select("chon=1").Length;
         n1 = dv.Table.Select("chon=0").Length;
         DataSet ads = new DataSet();
         ads = m_dsgiavp.Copy();
         //int n = ads.Tables[0].Rows.Count;
         if (n > 0)
         {
             int i = 0;
             if (MessageBox.Show(this, lan.Change_language_MessageText("Đồng ý cập nhật giá viện phí đã thay đổi (") + n.ToString() + " Mục)?", v.s_AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             {
                 butLuu.Enabled = false;
                 ttStatus.Text  = lan.Change_language_MessageText("Đang cập nhật, xin chờ ...!");
                 foreach (DataRow r in dv.Table.Select("chon=1"))
                 {
                     i++;
                     try
                     {
                         string s = v.fields(v.user + ".v_giavp_new", "id=" + r["id"].ToString());
                         v.upd_eve_tables(itablell, int.Parse(m_userid), "upd");
                         v.upd_eve_upd_del(itablell, int.Parse(m_userid), "upd", s);
                         ttStatus.Text = lan.Change_language_MessageText("Đang cập nhật:") + " " + i.ToString() + "/" + n.ToString() + " !";
                         statusStrip1.Refresh();
                         if (r["chon"].ToString() == "1")
                         {
                             if (!v.upd_v_giavp_new(decimal.Parse(r["id"].ToString()), decimal.Parse(r["id_loai"].ToString()), (decimal.Parse(r["stt"].ToString()) > 0 ? decimal.Parse(r["stt"].ToString()) : 1), r["ma"].ToString(), r["ten"].ToString(), r["dvt"].ToString(), (decimal.Parse(r["bhyt"].ToString()) >= 0 && decimal.Parse(r["bhyt"].ToString()) <= 100 ? decimal.Parse(r["bhyt"].ToString()) : 0), (decimal.Parse(r["gia_th"].ToString()) > 0 ? decimal.Parse(r["gia_th"].ToString()) : 0), (decimal.Parse(r["gia_bh"].ToString()) > 0 ? decimal.Parse(r["gia_bh"].ToString()) : 0), (decimal.Parse(r["gia_dv"].ToString()) > 0 ? decimal.Parse(r["gia_dv"].ToString()) : 0), (decimal.Parse(r["gia_nn"].ToString()) > 0 ? decimal.Parse(r["gia_nn"].ToString()) : 0), (decimal.Parse(r["gia_ksk"].ToString()) > 0 ? decimal.Parse(r["gia_ksk"].ToString()) : 0), (decimal.Parse(r["gia_cs"].ToString()) > 0 ? decimal.Parse(r["gia_cs"].ToString()) : 0), (decimal.Parse(r["vattu_th"].ToString()) > 0 ? decimal.Parse(r["vattu_th"].ToString()) : 0), (decimal.Parse(r["vattu_bh"].ToString()) > 0 ? decimal.Parse(r["vattu_bh"].ToString()) : 0), (decimal.Parse(r["vattu_dv"].ToString()) > 0 ? decimal.Parse(r["vattu_dv"].ToString()) : 0), (decimal.Parse(r["vattu_nn"].ToString()) > 0 ? decimal.Parse(r["vattu_nn"].ToString()) : 0), (decimal.Parse(r["vattu_cs"].ToString()) > 0 ? decimal.Parse(r["vattu_cs"].ToString()) : 0), (decimal.Parse(r["vattu_ksk"].ToString()) > 0 ? decimal.Parse(r["vattu_ksk"].ToString()) : 0), decimal.Parse(m_userid), decimal.Parse(cbloaitg.SelectedValue.ToString())))
                             {
                                 MessageBox.Show(lan.Change_language_MessageText(" Không cập được giá viện phí này. "), "Vienphi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                 return;
                             }
                         }
                     }
                     catch
                     {
                         throw;
                     }
                 }
                 ttStatus.Text  = lan.Change_language_MessageText("Cập nhật xong!");
                 butLuu.Enabled = true;
             }
         }
         else
         {
             int j = 0;
             if (MessageBox.Show(this, lan.Change_language_MessageText("Đồng ý cập nhật giá viện phí đã thay đổi (") + n1.ToString() + " Mục)?", v.s_AppName, MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             {
                 butLuu.Enabled = false;
                 ttStatus.Text  = lan.Change_language_MessageText("Đang cập nhật, xin chờ ...!");
                 foreach (DataRow r in dv.Table.Select("chon=0"))
                 {
                     j++;
                     try
                     {
                         string s = v.fields(v.user + ".v_giavp_new", "id=" + r["id"].ToString());
                         v.upd_eve_tables(itablell, int.Parse(m_userid), "upd");
                         v.upd_eve_upd_del(itablell, int.Parse(m_userid), "upd", s);
                         ttStatus.Text = lan.Change_language_MessageText("Đang cập nhật:") + " " + j.ToString() + "/" + n1.ToString() + " !";
                         statusStrip1.Refresh();
                         if (r["chon"].ToString() == "0")
                         {
                             if (!v.upd_v_giavp_new(decimal.Parse(r["id"].ToString()), decimal.Parse(r["id_loai"].ToString()), (decimal.Parse(r["stt"].ToString()) > 0 ? decimal.Parse(r["stt"].ToString()) : 1), r["ma"].ToString(), r["ten"].ToString(), r["dvt"].ToString(), (decimal.Parse(r["bhyt"].ToString()) >= 0 && decimal.Parse(r["bhyt"].ToString()) <= 100 ? decimal.Parse(r["bhyt"].ToString()) : 0), (decimal.Parse(r["gia_th"].ToString()) > 0 ? decimal.Parse(r["gia_th"].ToString()) : 0), (decimal.Parse(r["gia_bh"].ToString()) > 0 ? decimal.Parse(r["gia_bh"].ToString()) : 0), (decimal.Parse(r["gia_dv"].ToString()) > 0 ? decimal.Parse(r["gia_dv"].ToString()) : 0), (decimal.Parse(r["gia_nn"].ToString()) > 0 ? decimal.Parse(r["gia_nn"].ToString()) : 0), (decimal.Parse(r["gia_ksk"].ToString()) > 0 ? decimal.Parse(r["gia_ksk"].ToString()) : 0), (decimal.Parse(r["gia_cs"].ToString()) > 0 ? decimal.Parse(r["gia_cs"].ToString()) : 0), (decimal.Parse(r["vattu_th"].ToString()) > 0 ? decimal.Parse(r["vattu_th"].ToString()) : 0), (decimal.Parse(r["vattu_bh"].ToString()) > 0 ? decimal.Parse(r["vattu_bh"].ToString()) : 0), (decimal.Parse(r["vattu_dv"].ToString()) > 0 ? decimal.Parse(r["vattu_dv"].ToString()) : 0), (decimal.Parse(r["vattu_nn"].ToString()) > 0 ? decimal.Parse(r["vattu_nn"].ToString()) : 0), (decimal.Parse(r["vattu_cs"].ToString()) > 0 ? decimal.Parse(r["vattu_cs"].ToString()) : 0), (decimal.Parse(r["vattu_ksk"].ToString()) > 0 ? decimal.Parse(r["vattu_ksk"].ToString()) : 0), decimal.Parse(m_userid), decimal.Parse(cbloaitg.SelectedValue.ToString())))
                             {
                                 MessageBox.Show(lan.Change_language_MessageText(" Không cập được giá viện phí này. "), "Vienphi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                                 return;
                             }
                         }
                     }
                     catch
                     {
                         throw;
                     }
                 }
                 ttStatus.Text  = lan.Change_language_MessageText("Cập nhật xong!");
                 butLuu.Enabled = true;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
 }
Exemple #34
0
        private void SetDataConnection(
            object newDataSource
            , BindingMemberInfo newDisplayMember
            , bool force
            )
        {
            bool flag  = _dataSource != newDataSource;
            bool flag2 = !_displayMember.Equals(newDisplayMember);

            if (!_inSetDataConnection)
            {
                try
                {
                    if ((force || flag) || flag2)
                    {
                        _inSetDataConnection = true;
                        IList list  = (_dataManager != null) ? _dataManager.List : null;
                        bool  flag3 = _dataManager == null;
                        this.UnwireDataSource();
                        _dataSource    = newDataSource;
                        _displayMember = newDisplayMember;
                        this.WireDataSource();

                        if (_isDataSourceInitialized)
                        {
                            CurrencyManager manager = null;

                            if (((newDataSource != null) && (this.BindingContext != null)) && (newDataSource != Convert.DBNull))
                            {
                                manager = (CurrencyManager)this.BindingContext[newDataSource, newDisplayMember.BindingPath];
                            }

                            if (_dataManager != manager)
                            {
                                if (_dataManager != null)
                                {
                                    _dataManager.ItemChanged     -= new ItemChangedEventHandler(this.DataManager_ItemChanged);
                                    _dataManager.PositionChanged -= new EventHandler(this.DataManager_PositionChanged);
                                }

                                _dataManager = manager;

                                if (_dataManager != null)
                                {
                                    _dataManager.ItemChanged     += new ItemChangedEventHandler(this.DataManager_ItemChanged);
                                    _dataManager.PositionChanged += new EventHandler(this.DataManager_PositionChanged);
                                }
                            }

                            if (((_dataManager != null) && (flag2 || flag)) && (((_displayMember.BindingMember != null) && (_displayMember.BindingMember.Length != 0)) && !this.BindingMemberInfoInDataManager(_displayMember)))
                            {
                                throw new ArgumentException(res.Argument_WrongDisplayMember, "newDisplayMember");
                            }
                            if (((_dataManager != null) && ((flag || flag2) || force)) && (flag2 || (force && ((list != _dataManager.List) || flag3))))
                            {
                                ConstructorInfo ci = typeof(ItemChangedEventArgs).GetConstructor(
                                    BindingFlags.CreateInstance | BindingFlags.NonPublic | BindingFlags.Instance
                                    , null
                                    , new Type[] { typeof(int) }
                                    , null
                                    );

                                Debug.Assert(ci != null, "ci != null");

                                this.DataManager_ItemChanged(
                                    _dataManager
                                    , (ItemChangedEventArgs)ci.Invoke(new object[] { -1 })
                                    );
                            }
                        }
                    }

                    if (flag)
                    {
                        this.OnDataSourceChanged(EventArgs.Empty);
                    }

                    if (flag2)
                    {
                        this.OnDisplayMemberChanged(EventArgs.Empty);
                    }
                }
                finally
                {
                    _inSetDataConnection = false;
                }
            }
        }
Exemple #35
0
 private void MoveLast(CurrencyManager myCurrencyManager)
 {
     myCurrencyManager.Position = myCurrencyManager.Count - 1;
 }
Exemple #36
0
		protected override bool Commit (CurrencyManager cm, int RowNum)
		{
			/*
			 * Parse the data and write to underlying record.
			 */

			HideEditBox();   /* return focus to the DataGrid control */
			DataGridTextBox box = (DataGridTextBox)TextBox;
			Decimal Value;

			/* Do not write data if not editing. */
			if (box.IsInEditOrNavigateMode)
				return true;

			if (TextBox.Text == "") {
				/* in this example, "" maps to DBNull */
				SetColumnValueAtRow(cm, RowNum, DBNull.Value);
			}
			else {
				/* Parse the data. */
				try {
					if (TextBox.Text.ToUpper().EndsWith("CR"))
						Value = -Decimal.Parse(TextBox.Text.Substring(0, TextBox.Text.Length - 2));
					else					
						Value = Decimal.Parse(TextBox.Text);
				} catch {
					return false;
				}
				SetColumnValueAtRow(cm, RowNum, Value);   /* Write new value. */
			}

			EndEdit();   /* Let the DataGrid know that processing is completed. */
			return true;
		}
Exemple #37
0
 public void EditVal(CurrencyManager cm, int row, Rectangle rec,
                     bool readOnly, string text)
 {
     this.Edit(cm, row, rec, readOnly, text);
 }