예제 #1
0
        /// <summary>
        /// Fills to control on cell double click in Datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvAccountGroup_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
                    AccountGroupSP spAccountGroup = new AccountGroupSP();
                    InfoAccountGroup = spAccountGroup.AccountGroupViewForUpdate(Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString()));
                    bool Isdefault=InfoAccountGroup.IsDefault;
                    txtAccountGroupName.Text = InfoAccountGroup.AccountGroupName;
                    cmbGroupUnder.SelectedValue = InfoAccountGroup.GroupUnder.ToString();
                    decimal decAccountGroupId =Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                    string strNature = spAccountGroup.AccountGroupNatureUnderGroup(decAccountGroupId);
                    if (strNature != "NA")
                    {
                        cmbNature.Text = InfoAccountGroup.Nature;
                        cmbNature.Enabled = false;
                    }
                    else
                    {
                        cmbNature.Text = InfoAccountGroup.Nature;
                        cmbNature.Enabled = true;
                    }
                    if (Isdefault)
                    {
                        decimal decAffectGrossProfit = Convert.ToDecimal(InfoAccountGroup.AffectGrossProfit);
                        if (decAffectGrossProfit == 0)
                        {
                            cmbAffectGrossProfit.Text = "No";

                        }
                        else
                        {
                            cmbAffectGrossProfit.Text = "Yes";
                        }
                    }
                    else
                    {
                        cmbAffectGrossProfit.Text = InfoAccountGroup.AffectGrossProfit;
                    }
                    txtNarration.Text = InfoAccountGroup.Narration;
                    btnSave.Text = "Update";
                    txtAccountGroupName.Focus();
                    btnDelete.Enabled = true;
                    strAccountGroupName = InfoAccountGroup.AccountGroupName;
                    decAccountGroupIdForEdit = Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString());
                    inId = Convert.ToInt32(InfoAccountGroup.AccountGroupId.ToString());
                    isDefault = Convert.ToBoolean(InfoAccountGroup.IsDefault);

                    if (isDefault == true  && strNature!="NA")
                    {
                        txtAccountGroupName.Enabled = false;
                        cmbAffectGrossProfit.Enabled = false;
                        cmbGroupUnder.Enabled = false;
                        cmbNature.Enabled = false;
                    }
                    else
                    {
                        if (strNature == "NA")
                        {
                            txtAccountGroupName.Enabled = true;
                            cmbAffectGrossProfit.Enabled = true;
                            cmbGroupUnder.Enabled = true;
                            cmbNature.Enabled = true;
                        }
                        
                     }
                    if (isDefault == false)
                    {
                        if (spAccountGroup.AccountGroupCheckExistenceOfUnderGroup(Convert.ToDecimal(inId.ToString())) == false)
                        {
                            cmbAffectGrossProfit.Enabled = false;
                            cmbGroupUnder.Enabled = false;
                            cmbNature.Enabled = false;
                        }
                        else
                        {
                            if (strNature == "NA")
                            {
                                cmbAffectGrossProfit.Enabled = true;
                                cmbGroupUnder.Enabled = true;
                                cmbNature.Enabled = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AG18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
예제 #2
0
        /// <summary>
        /// Fills to control on cell double click in Datagridview
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dgvAccountGroup_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            try
            {
                if (e.RowIndex != -1)
                {
                    AccountGroupInfo InfoAccountGroup = new AccountGroupInfo();
                    AccountGroupSP   spAccountGroup   = new AccountGroupSP();
                    InfoAccountGroup = spAccountGroup.AccountGroupViewForUpdate(Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString()));
                    bool Isdefault = InfoAccountGroup.IsDefault;
                    txtAccountGroupName.Text    = InfoAccountGroup.AccountGroupName;
                    cmbGroupUnder.SelectedValue = InfoAccountGroup.GroupUnder.ToString();
                    decimal decAccountGroupId = Convert.ToDecimal(cmbGroupUnder.SelectedValue.ToString());
                    string  strNature         = spAccountGroup.AccountGroupNatureUnderGroup(decAccountGroupId);
                    if (strNature != "NA")
                    {
                        cmbNature.Text    = InfoAccountGroup.Nature;
                        cmbNature.Enabled = false;
                    }
                    else
                    {
                        cmbNature.Text    = InfoAccountGroup.Nature;
                        cmbNature.Enabled = true;
                    }
                    if (Isdefault)
                    {
                        decimal decAffectGrossProfit = Convert.ToDecimal(InfoAccountGroup.AffectGrossProfit);
                        if (decAffectGrossProfit == 0)
                        {
                            cmbAffectGrossProfit.Text = "No";
                        }
                        else
                        {
                            cmbAffectGrossProfit.Text = "Yes";
                        }
                    }
                    else
                    {
                        cmbAffectGrossProfit.Text = InfoAccountGroup.AffectGrossProfit;
                    }
                    txtNarration.Text = InfoAccountGroup.Narration;
                    btnSave.Text      = "Update";
                    txtAccountGroupName.Focus();
                    btnDelete.Enabled        = true;
                    strAccountGroupName      = InfoAccountGroup.AccountGroupName;
                    decAccountGroupIdForEdit = Convert.ToDecimal(dgvAccountGroup.CurrentRow.Cells["dgvtxtAccountGroupId"].Value.ToString());
                    inId      = Convert.ToInt32(InfoAccountGroup.AccountGroupId.ToString());
                    isDefault = Convert.ToBoolean(InfoAccountGroup.IsDefault);

                    if (isDefault == true && strNature != "NA")
                    {
                        txtAccountGroupName.Enabled  = false;
                        cmbAffectGrossProfit.Enabled = false;
                        cmbGroupUnder.Enabled        = false;
                        cmbNature.Enabled            = false;
                    }
                    else
                    {
                        if (strNature == "NA")
                        {
                            txtAccountGroupName.Enabled  = true;
                            cmbAffectGrossProfit.Enabled = true;
                            cmbGroupUnder.Enabled        = true;
                            cmbNature.Enabled            = true;
                        }
                    }
                    if (isDefault == false)
                    {
                        if (spAccountGroup.AccountGroupCheckExistenceOfUnderGroup(Convert.ToDecimal(inId.ToString())) == false)
                        {
                            cmbAffectGrossProfit.Enabled = false;
                            cmbGroupUnder.Enabled        = false;
                            cmbNature.Enabled            = false;
                        }
                        else
                        {
                            if (strNature == "NA")
                            {
                                cmbAffectGrossProfit.Enabled = true;
                                cmbGroupUnder.Enabled        = true;
                                cmbNature.Enabled            = true;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("AG18:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }