示例#1
0
        public static void SubledgerBtnClick(string _SearchKey, TextBox txtBoxName, int LedgerId, EventArgs e)
        {
            ClsGlobal.LedgerId = LedgerId;
            PickList frmPickList = new PickList("Subledger", _SearchKey);

            if (PickList.dt.Rows.Count > 0)
            {
                frmPickList.ShowDialog();
                if (frmPickList.SelectedList.Count > 0)
                {
                    txtBoxName.Text = frmPickList.SelectedList[0]["SubledgerDesc"].ToString().Trim();
                    txtBoxName.Tag  = Convert.ToInt32(frmPickList.SelectedList[0]["SubledgerId"].ToString().Trim());
                    txtBoxName.SelectAll();
                }
                frmPickList.Dispose();
            }
            else
            {
                MessageBox.Show("No List Available in Subledger !", "Mr. Solution", MessageBoxButtons.OK, MessageBoxIcon.Information);
                txtBoxName.Focus();
                return;
            }
            txtBoxName.Focus();
        }
示例#2
0
        public static void DepartmentBtnClick(string _SearchKey, TextBox txtBoxName, EventArgs e)
        {
            if (_SearchKey == "Escape")
            {
                _SearchKey = "";
            }
            IDepartment _objDepartment = new ClsDepartment();
            DataTable   dt             = _objDepartment.DepartmentLevel();

            if (dt.Rows.Count > 0)
            {
                DataRow[] result1 = dt.Select("Departmentlevel = 'I'");
                if (result1.Length > 0)
                {
                    PickList frmPickList = new PickList("DepartmentI", _SearchKey);
                    frmPickList.ShowDialog();
                    if (frmPickList.SelectedList.Count > 0)
                    {
                        txtBoxName.Text = frmPickList.SelectedList[0]["DepartmentDesc"].ToString().Trim();
                        txtBoxName.Tag  = Convert.ToInt32(frmPickList.SelectedList[0]["DepartmentId"].ToString().Trim());
                    }
                    else
                    {
                        txtBoxName.Text = "";
                        txtBoxName.Tag  = "";
                    }
                    frmPickList.Dispose();
                }

                DataRow[] result2 = dt.Select("Departmentlevel = 'II'");
                if (result2.Length > 0)
                {
                    _SearchKey = "";
                    PickList frmPickList = new PickList("DepartmentII", _SearchKey);
                    frmPickList.ShowDialog();
                    txtBoxName.Text = txtBoxName.Text.Trim() + '|';
                    txtBoxName.Tag  = txtBoxName.Tag.ToString().Trim() + '|';
                    if (frmPickList.SelectedList.Count > 0)
                    {
                        txtBoxName.Text = txtBoxName.Text + frmPickList.SelectedList[0]["DepartmentDesc"].ToString().Trim();
                        txtBoxName.Tag  = txtBoxName.Tag.ToString() + Convert.ToInt32(frmPickList.SelectedList[0]["DepartmentId"].ToString().Trim());
                    }
                    else
                    {
                        string[] _arr1 = txtBoxName.Text.Split('|');
                        string[] _arr2 = txtBoxName.Tag.ToString().Split('|');
                        txtBoxName.Text = _arr1[0] + "|";
                        txtBoxName.Tag  = _arr2[0] + "|";
                    }
                    frmPickList.Dispose();
                }
                else
                {
                    string[] _arr1 = txtBoxName.Text.Split('|');
                    string[] _arr2 = txtBoxName.Tag.ToString().Split('|');
                    txtBoxName.Text = _arr1[0] + "|";
                    txtBoxName.Tag  = _arr2[0] + "|";
                }

                DataRow[] result3 = dt.Select("Departmentlevel = 'III'");
                if (result3.Length > 0)
                {
                    _SearchKey = "";
                    PickList frmPickList = new PickList("DepartmentIII", _SearchKey);
                    frmPickList.ShowDialog();
                    txtBoxName.Text = txtBoxName.Text.Trim() + '|';
                    txtBoxName.Tag  = txtBoxName.Tag.ToString().Trim() + '|';
                    if (frmPickList.SelectedList.Count > 0)
                    {
                        txtBoxName.Text = txtBoxName.Text + frmPickList.SelectedList[0]["DepartmentDesc"].ToString().Trim();
                        txtBoxName.Tag  = txtBoxName.Tag.ToString() + Convert.ToInt32(frmPickList.SelectedList[0]["DepartmentId"].ToString().Trim());
                    }
                    else
                    {
                        string[] _arr1 = txtBoxName.Text.Split('|');
                        string[] _arr2 = txtBoxName.Tag.ToString().Split('|');
                        txtBoxName.Text = _arr1[0] + "|" + _arr1[1] + "|";
                        txtBoxName.Tag  = _arr2[0] + "|" + _arr2[1] + "|";
                    }
                    frmPickList.Dispose();
                }
                else
                {
                    string[] _arr1 = txtBoxName.Text.Split('|');
                    string[] _arr2 = txtBoxName.Tag.ToString().Split('|');
                    txtBoxName.Text = _arr1[0] + "|" + _arr1[1] + "|";
                    txtBoxName.Tag  = _arr2[0] + "|" + _arr2[1] + "|";
                }

                DataRow[] result4 = dt.Select("Departmentlevel = 'IV'");
                if (result4.Length > 0)
                {
                    _SearchKey = "";
                    PickList frmPickList = new PickList("DepartmentIV", _SearchKey);
                    frmPickList.ShowDialog();
                    txtBoxName.Text = txtBoxName.Text.Trim() + '|';
                    if (frmPickList.SelectedList.Count > 0)
                    {
                        txtBoxName.Text = txtBoxName.Text + frmPickList.SelectedList[0]["DepartmentDesc"].ToString().Trim();
                        txtBoxName.Tag  = txtBoxName.Tag.ToString() + Convert.ToInt32(frmPickList.SelectedList[0]["DepartmentId"].ToString().Trim());
                    }
                    else
                    {
                        string[] _arr1 = txtBoxName.Text.Split('|');
                        string[] _arr2 = txtBoxName.Tag.ToString().Split('|');
                        txtBoxName.Text = _arr1[0] + "|" + _arr1[1] + "|" + _arr1[2] + "|";
                        txtBoxName.Tag  = _arr2[0] + "|" + _arr2[1] + "|" + _arr2[2] + "|";
                    }
                    frmPickList.Dispose();
                }
                else
                {
                    string[] _arr1 = txtBoxName.Text.Split('|');
                    string[] _arr2 = txtBoxName.Tag.ToString().Split('|');
                    txtBoxName.Text = _arr1[0] + "|" + _arr1[1] + "|" + _arr1[2] + "|";
                    txtBoxName.Tag  = _arr2[0] + "|" + _arr2[1] + "|" + _arr2[2] + "|";
                }
            }
        }
示例#3
0
        public static void GetVoucherNo2(string DocModule, TextBox _TxtVoucherNo, TextBox _NextFocusControl, string Tag, string _SearchKey, int DocId = 0)
        {
            ClsCommon objCommon = new ClsCommon();
            int       CountVoucherNoByModule = objCommon.CountVoucherNoByModule(DocModule);

            if (CountVoucherNoByModule == 1)
            {
                string[] VoucherNoDetails = objCommon.GetVoucherNo("", DocModule, ClsGlobal.BranchId, ClsGlobal.CompanyUnitId);
                _TxtVoucherNo.Text = VoucherNoDetails[0]; // VoucherNo
                _TxtVoucherNo.Tag  = VoucherNoDetails[1]; // DocId
                //VoucherNoDetails[2]; // NumericalStyle
                if (VoucherNoDetails[2] == "Auto")
                {
                    _TxtVoucherNo.Enabled = false;
                    _NextFocusControl.Focus();
                }
                else
                {
                    _TxtVoucherNo.Enabled = true;
                    _TxtVoucherNo.SelectAll();
                    _TxtVoucherNo.Focus();
                }
            }
            else if (CountVoucherNoByModule > 1)
            {
                if (DocId > 0)
                {
                    string[] VoucherNoDetails = objCommon.GetVoucherNo(DocId.ToString(), DocModule, ClsGlobal.BranchId, ClsGlobal.CompanyUnitId);
                    _TxtVoucherNo.Text = VoucherNoDetails[0];
                    _TxtVoucherNo.Tag  = VoucherNoDetails[1];
                    if (VoucherNoDetails[2] == "Auto")
                    {
                        _TxtVoucherNo.Enabled = false;
                        _NextFocusControl.Focus();
                    }
                    else
                    {
                        _TxtVoucherNo.Enabled = true;
                        _TxtVoucherNo.SelectAll();
                        _TxtVoucherNo.Focus();
                    }
                }
                else
                {
                    Common.PickList frmPickList = new Common.PickList("DocumentNumber." + DocModule, _SearchKey);
                    if (Common.PickList.dt != null)
                    {
                        if (Common.PickList.dt.Rows.Count > 0)
                        {
                            frmPickList.ShowDialog();
                            if (frmPickList.SelectedList.Count > 0 && Tag == "NEW")
                            {
                                string[] VoucherNoDetails = objCommon.GetVoucherNo(frmPickList.SelectedList[0]["DocId"].ToString().Trim(), DocModule, ClsGlobal.BranchId, ClsGlobal.CompanyUnitId);
                                _TxtVoucherNo.Text = VoucherNoDetails[0];
                                _TxtVoucherNo.Tag  = VoucherNoDetails[1];
                                if (VoucherNoDetails[2] == "Auto")
                                {
                                    _TxtVoucherNo.Enabled = false;
                                    _NextFocusControl.Focus();
                                }
                                else
                                {
                                    _TxtVoucherNo.Enabled = true;
                                    _TxtVoucherNo.SelectAll();
                                    _TxtVoucherNo.Focus();
                                }
                            }
                            frmPickList.Dispose();
                        }
                    }
                }
                //_TxtVoucherNo.Focus();
            }
        }