当前位置: 首页>>代码示例>>C#>>正文


C# DateValidation.DateValidationFunctionMFDEXPD方法代码示例

本文整理汇总了C#中Open_Miracle.DateValidation.DateValidationFunctionMFDEXPD方法的典型用法代码示例。如果您正苦于以下问题:C# DateValidation.DateValidationFunctionMFDEXPD方法的具体用法?C# DateValidation.DateValidationFunctionMFDEXPD怎么用?C# DateValidation.DateValidationFunctionMFDEXPD使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Open_Miracle.DateValidation的用法示例。


在下文中一共展示了DateValidation.DateValidationFunctionMFDEXPD方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: dgvProductCreation_CellValueChanged

        /// <summary>
        /// work on dgvProductCreation CellValueChanged event
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvProductCreation_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                CheckInvalidEntries(e);


                if (e.RowIndex > -1 && e.ColumnIndex > -1)
                {


                    if (dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtqty"].Value != null && dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtqty"].Value.ToString() != "")
                    {
                        if (dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtrate"].Value != null && dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtrate"].Value.ToString() != "")
                        {
                            int inDecimalPlace = PublicVariables._inNoOfDecimalPlaces;
                            decimal decQuantity = Convert.ToDecimal(dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtqty"].Value.ToString());
                            decimal decRate = Convert.ToDecimal(dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtrate"].Value.ToString());
                            decimal decTotal = Math.Round(decQuantity * decRate, inDecimalPlace);
                            dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtamount"].Value = decTotal;

                        }
                        else
                        {
                            dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtamount"].Value = 0;
                        }

                    }
                    TextBox txtMFD = new TextBox();
                    TextBox txtEXPD = new TextBox();
                    if ((dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvtxManfDate" || dgvProductCreation.Columns[e.ColumnIndex].Name == "dgvtxtExpDate") && (cmbAllowBatch.SelectedIndex == 1))
                    {
                        DateValidation objDateValidation = new DateValidation();
                        TextBox txt = new TextBox();

                        if (dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value != null)
                        {
                            txt.Text = dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value.ToString();
                            bool isDate = objDateValidation.DateValidationFunctionMFDEXPD(txt);
                            if (isDate)
                            {
                                dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = txt.Text;
                                txtMFD.Text = dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value.ToString();
                            }
                            else
                            {
                                dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value = string.Empty;
                                txtMFD.Text = dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxManfDate"].Value.ToString();
                            }
                        }

                        if (dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value != null)
                        {
                            txt.Text = dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value.ToString();
                            bool isDate = objDateValidation.DateValidationFunctionMFDEXPD(txt);
                            if (isDate)
                            {
                                dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = txt.Text;
                                txtEXPD.Text = dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value.ToString();
                            }
                            else
                            {
                                dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = string.Empty;
                                txtEXPD.Text = dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value.ToString();
                            }
                        }
                        if (txtEXPD.Text != String.Empty && txtMFD.Text != string.Empty)
                        {

                            if (Convert.ToDateTime(txtEXPD.Text) < Convert.ToDateTime(txtMFD.Text))
                            {
                                MessageBox.Show("EXPD should be greater than or equal to MFD", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
                                dgvProductCreation.Rows[e.RowIndex].Cells["dgvtxtExpDate"].Value = string.Empty;
                            }
                        }
                    }

                    for (int inI = 0; inI < dgvProductCreation.RowCount - 1; inI++)
                    {

                        if (inI == 0)
                        {

                            dgvProductCreation.Rows[inI].Cells["dgvtxtrate"].ReadOnly = false;

                            dgvProductCreation.Rows[inI].Cells["dgvtxtunit"].Value = strUnitNameForGrid;
                        }
                        else
                        {
                            dgvProductCreation.Rows[inI].Cells["dgvtxtrate"].Value = dgvProductCreation.Rows[0].Cells["dgvtxtrate"].Value;
                            dgvProductCreation.Rows[inI].Cells["dgvtxtrate"].ReadOnly = true;
                            dgvProductCreation.Rows[inI].Cells["dgvtxtunit"].Value = strUnitNameForGrid;
                        }
                    }
                }
//.........这里部分代码省略.........
开发者ID:jsoques,项目名称:openmiracle,代码行数:101,代码来源:frmProductCreation.cs


注:本文中的Open_Miracle.DateValidation.DateValidationFunctionMFDEXPD方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。