當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。