コード例 #1
0
        public void LoadDataByRegNo(string sIssueUpdateTrnsNo, string sRegNo, string sApprovalStaus)
        {
            TotalClear();
            Issue oIssue = new Issue();

            oIssue.RegNo = sRegNo != "" ? sRegNo : txtRegistrationNo.Text.Trim();
            oIssue.UpdateIssueTransNo = sIssueUpdateTrnsNo;
            if (sApprovalStaus.Equals("2"))
            {
                oIssue.IsApproved = 2;
            }
            Config oConfig = (Config)Session[Constants.SES_USER_CONFIG];

            if (oConfig != null)
            {
                oIssue.BankID     = oConfig.BankCodeID;
                oIssue.DivisionID = oConfig.DivisionID;
            }

            IssueDAL oIssueDAL = new IssueDAL();
            Result   oResult   = oIssueDAL.LoadDataByRegNo(oIssue);

            oIssue = (Issue)oResult.Return;
            //Store Issue object to Session
            Session[Constants.SES_CURRENT_ISSUE] = oIssue;

            if (oResult.Status)
            {
                #region Issue Detail
                LoadBySPType(oIssue);
                hdUpdateIssueTransNo.Value = oIssue.UpdateIssueTransNo;
                hdIssueTransNo.Value       = oIssue.IssueTransNo;
                //Issue Details
                DDListUtil.Assign(ddlSpType, oIssue.SPType.SPTypeID);
                DDListUtil.Assign(ddlCustomerType, oIssue.CustomerType.CustomerTypeID);
                DDListUtil.Assign(ddlBranch, oIssue.Branch.BranchID);
                DDListUtil.Assign(ddlYear, oIssue.UserDetails.CheckDate.Year);

                txtTransNo.Text = oIssue.UpdateIssueTransNo;
                if (oIssue.ChangeDate.Year <= 1900)
                {
                    txtChangeDate.Text = DateTime.Now.ToString(Constants.DATETIME_FORMAT);
                }
                else
                {
                    txtChangeDate.Text = oIssue.ChangeDate.ToString(Constants.DATETIME_FORMAT);
                }
                txtTotalAmount.Text    = oIssue.IssueAmount.ToString();
                txtIssueDate.Text      = oIssue.OldVersionIssueDate.ToString(Constants.DATETIME_FORMAT);
                txtRegistrationNo.Text = oIssue.RegNo;
                #endregion

                #region Change Details
                txtRemarks.Text = oIssue.IssueUpdateRemarks;

                if (oIssue.UpdateNewIssueDate.Year <= 1900)
                {
                    txtNewIssueDate.Text = string.Empty;
                }
                else
                {
                    txtNewIssueDate.Text = oIssue.UpdateNewIssueDate.ToString(Constants.DATETIME_FORMAT);
                }
                txtNewIssueName.Text = oIssue.IssueName;
                txtOldIssueName.Text = oIssue.OldIssueName;
                txtOldIssueDate.Text = oIssue.OldVersionIssueDate.ToString(Constants.DATETIME_FORMAT);

                #endregion

                #region Customer Details
                gvCustomerDetail.DataSource = null;
                gvCustomerDetail.DataBind();
                if (oIssue.CustomerDetailsList.Count > 0)
                {
                    DataTable dtCustomerDetail = new DataTable("dtCustomerDetail");

                    dtCustomerDetail.Columns.Add(new DataColumn("bfCustomerID", typeof(string)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfCustomerName", typeof(string)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfDateOfBirth", typeof(DateTime)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfAddress", typeof(string)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfPhone", typeof(string)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfDateOfBirth2", typeof(DateTime)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfNationality", typeof(string)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfPassportNo", typeof(string)));
                    dtCustomerDetail.Columns.Add(new DataColumn("bfForeignAddress", typeof(string)));

                    DataRow rowCD = null;
                    for (int i = 0; i < oIssue.CustomerDetailsList.Count; i++)
                    {
                        rowCD = dtCustomerDetail.NewRow();

                        rowCD["bfCustomerID"]   = oIssue.CustomerDetailsList[i].CustomerID.ToString();
                        rowCD["bfCustomerName"] = oIssue.CustomerDetailsList[i].CustomerName.ToString();
                        if (oIssue.CustomerDetailsList[i].DateOfBirth.Year > 1900)
                        {
                            rowCD["bfDateOfBirth"] = oIssue.CustomerDetailsList[i].DateOfBirth;
                        }
                        rowCD["bfAddress"] = oIssue.CustomerDetailsList[i].Address.ToString();
                        rowCD["bfPhone"]   = oIssue.CustomerDetailsList[i].Phone.ToString();
                        //if (oIssue.CustomerDetailsList[i].DateOfBirth2.Year > 1900)
                        //{
                        //    rowCD["bfDateOfBirth2"] = oIssue.CustomerDetailsList[i].DateOfBirth2;
                        //}
                        rowCD["bfNationality"]    = oIssue.CustomerDetailsList[i].Nationality.ToString();
                        rowCD["bfPassportNo"]     = oIssue.CustomerDetailsList[i].PassportNo.ToString();
                        rowCD["bfForeignAddress"] = oIssue.CustomerDetailsList[i].ForeignAddress.ToString();

                        dtCustomerDetail.Rows.Add(rowCD);
                    }
                    gvCustomerDetail.DataSource = dtCustomerDetail;
                    gvCustomerDetail.DataBind();
                }
                #endregion

                #region Nominee Details
                gvNomDetail.DataSource = null;
                gvNomDetail.DataBind();

                if (oIssue.NomineeList.Count > 0 || oIssue.OldNomineeList.Count > 0)
                {
                    DataTable dtNominee = new DataTable();

                    dtNominee.Columns.Add(new DataColumn("SlNo", typeof(string)));
                    dtNominee.Columns.Add(new DataColumn("NomineeName", typeof(string)));
                    dtNominee.Columns.Add(new DataColumn("Relation", typeof(string)));
                    dtNominee.Columns.Add(new DataColumn("Address", typeof(string)));
                    dtNominee.Columns.Add(new DataColumn("NomineeShare", typeof(string)));
                    dtNominee.Columns.Add(new DataColumn("Amount", typeof(string)));

                    DataRow rowNominee = null;
                    for (int i = 0; i < oIssue.NomineeList.Count; i++)
                    {
                        rowNominee = dtNominee.NewRow();

                        rowNominee["Slno"]         = oIssue.NomineeList[i].SlNo;
                        rowNominee["NomineeName"]  = oIssue.NomineeList[i].NomineeName;
                        rowNominee["Relation"]     = oIssue.NomineeList[i].Relation;
                        rowNominee["Address"]      = oIssue.NomineeList[i].Address;
                        rowNominee["NomineeShare"] = oIssue.NomineeList[i].NomineeShare;
                        rowNominee["Amount"]       = oIssue.NomineeList[i].Amount;

                        dtNominee.Rows.Add(rowNominee);
                    }

                    gvNomDetail.DataSource = dtNominee;
                    gvNomDetail.DataBind();

                    dtNominee.Rows.Clear();

                    for (int iNomIndx = 0; iNomIndx < oIssue.OldNomineeList.Count; iNomIndx++)
                    {
                        rowNominee = dtNominee.NewRow();

                        rowNominee["Slno"]         = oIssue.OldNomineeList[iNomIndx].SlNo;
                        rowNominee["NomineeName"]  = oIssue.OldNomineeList[iNomIndx].NomineeName;
                        rowNominee["Relation"]     = oIssue.OldNomineeList[iNomIndx].Relation;
                        rowNominee["Address"]      = oIssue.OldNomineeList[iNomIndx].Address;
                        rowNominee["NomineeShare"] = oIssue.OldNomineeList[iNomIndx].NomineeShare;
                        rowNominee["Amount"]       = oIssue.OldNomineeList[iNomIndx].Amount;

                        dtNominee.Rows.Add(rowNominee);
                    }

                    gvOldNomineeList.DataSource = dtNominee;
                    gvOldNomineeList.DataBind();
                }
                #endregion

                #region User Details
                UserDetails oUserDetails = ucUserDet.UserDetail;
                if (!SEARCH_FROM.Equals(1))
                {
                    if (SEARCH_FROM.Equals(2) && sApprovalStaus.Equals("1"))
                    {
                        //Lodaing from StopSearch form
                        //with unapproved data
                        oUserDetails.MakerID        = oIssue.UserDetails.MakerID;
                        oUserDetails.MakeDate       = DateTime.Now;
                        oUserDetails.CheckerID      = oIssue.UserDetails.CheckerID;
                        oUserDetails.CheckDate      = oIssue.UserDetails.CheckDate;
                        oUserDetails.CheckerComment = oIssue.UserDetails.CheckerComment;
                        ucUserDet.UserDetail        = oUserDetails;
                    }
                    else if (SEARCH_FROM.Equals(0))
                    {
                        //Lodaing for Approve
                        //viewed by Checker
                        oUserDetails.MakerID  = oIssue.UserDetails.MakerID;
                        oUserDetails.MakeDate = DateTime.Now;
                        ucUserDet.UserDetail  = oUserDetails;
                    }
                }
                #endregion
            }
            else
            {
                ucMessage.OpenMessage("Invalid Registration no. Please check..", Constants.MSG_TYPE_INFO);
                ScriptManager.RegisterStartupScript(this.UpdatePanel2, typeof(string), Constants.POPUP_WINDOW, Util.OpenPopup("info"), true);
            }
        }