Пример #1
0
        public MainForm()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent call
            //
            DaysAgoText.Text = DaysAgo.ToString();
            int totalwidth = BatchManagerList.Width - 2 * SystemInformation.Border3DSize.Width;

            BatchManagerList.Columns.Add("Process Operation ID", (int)(totalwidth * 0.2), System.Windows.Forms.HorizontalAlignment.Left);
            BatchManagerList.Columns.Add("Executable", (int)(totalwidth * 0.2), System.Windows.Forms.HorizontalAlignment.Left);
            BatchManagerList.Columns.Add("Machine ID", (int)(totalwidth * 0.15), System.Windows.Forms.HorizontalAlignment.Left);
            BatchManagerList.Columns.Add("Brick", (int)(totalwidth * 0.075), System.Windows.Forms.HorizontalAlignment.Left);
            BatchManagerList.Columns.Add("Plate", (int)(totalwidth * 0.075), System.Windows.Forms.HorizontalAlignment.Left);
            BatchManagerList.Columns.Add("Level", (int)(totalwidth * 0.1), System.Windows.Forms.HorizontalAlignment.Left);
            BatchManagerList.Columns.Add("Status", (int)(totalwidth * 0.2), System.Windows.Forms.HorizontalAlignment.Left);

            StartStopButton.Text    = "Start";
            BMRefreshTimer.Interval = 20 * 1000;
            BMRefreshTimer.Tick    += new System.EventHandler(BMRefresh);
            System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Tcp.TcpChannel());
            Credentials            = SySal.OperaDb.OperaDbCredentials.CreateFromRecord();
            OPERAUsernameText.Text = Credentials.OPERAUserName;
            OPERAPasswordText.Text = Credentials.OPERAPassword;
            BMPauseButton.Enabled  = false;
            BMResumeButton.Enabled = false;
            BMAbortButton.Enabled  = false;
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            string PageID = DbSettings.Menus.LoansPending;

            Users          objUsr    = new Users();
            UserKeyDetails objUsrDet = objUsr.GetUserKeyDetails();

            string UserID       = objUsrDet.UserID;
            string UserStatusID = objUsrDet.StatusID;

            string UserRoleID   = objUsrDet.RoleID;
            string UserOfficeID = objUsrDet.OfficeID;


            if (UserID != null && UserStatusID == DbSettings.UserStatus.Active)
            {
                CustEnum.PageAccess Access = objUsr.CheckPageAccess(UserRoleID, PageID);

                if (Access == CustEnum.PageAccess.Yes)
                {
                    DataSet dsLoans = objUsr.GetNewGroupsForUserID(UserID);

                    if (!DataUtils.IsDataSetNull(dsLoans, 0))
                    {
                        //display the loan count
                        LoanCount.InnerHtml = dsLoans.Tables[0].Rows.Count.ToString();

                        StringBuilder sbrLoans = new StringBuilder();

                        sbrLoans.Append("<table class='table table-bordered display' id='tblLoans'>");
                        sbrLoans.Append("<thead>");
                        sbrLoans.Append("<tr>");
                        sbrLoans.Append("<th>Loan</th>");
                        sbrLoans.Append("<th>Group</th>");
                        sbrLoans.Append("<th>Applied On</th>");
                        sbrLoans.Append("<th>Applied By</th>");
                        sbrLoans.Append("<th>Center</th>");
                        sbrLoans.Append("<th>Village</th>");
                        sbrLoans.Append("<th>Branch</th>");
                        sbrLoans.Append("</tr>");
                        sbrLoans.Append("</thead>");

                        sbrLoans.Append("<tbody>");

                        foreach (DataRow dr in dsLoans.Tables[0].Rows)
                        {
                            string GroupID = dr["GroupID"].ToString();

                            int DaysAgo;
                            int.TryParse(dr["DaysAgo"].ToString(), out DaysAgo);
                            string DaysPlurality = "Days";

                            string AppliedBy = dr["GroupStaff"].ToString();

                            string LoanURL = Page.GetRouteUrl(AppRoutes.DisburseLoans.Name, new { OfficeID = dr["GroupID"].ToString() });

                            string CenterID  = dr["CenterID"].ToString();
                            string CenterURL = Page.GetRouteUrl(AppRoutes.Center.Name, new { OfficeID = CenterID });

                            string Village    = dr["Village"].ToString();
                            string VillageURL = Page.GetRouteUrl(AppRoutes.Village.Name, new { OfficeID = dr["VillageID"].ToString() });

                            string Branch    = dr["Branch"].ToString();
                            string BranchURL = Page.GetRouteUrl(AppRoutes.BranchOffice.Name, new { OfficeID = dr["BranchID"].ToString() });

                            DateTime AppliedOnUTC       = new DateTime();
                            string   AppliedOnLocalDate = string.Empty;

                            AppliedOnUTC       = DateTime.SpecifyKind(DateTime.Parse(dr["CreatedDateTime"].ToString()), DateTimeKind.Utc);
                            AppliedOnLocalDate = TimeZoneInfo.ConvertTimeFromUtc(AppliedOnUTC, AppSettings.TimeZoneIst).ToDateShortMonth(false, '-');

                            sbrLoans.Append("<tr>");
                            sbrLoans.Append("<td><a class='btn btn-success' href='" + LoanURL + "' >View Loan Form</a></td>");

                            //the following is for the sake of table sorting where Center 8 > center 10!
                            string GroupURL = Page.GetRouteUrl(AppRoutes.Groups.Name, new { }) + "?" + AppSettings.QueryStr.Group.Name + "=" + GroupID;

                            if (int.Parse(GroupID) < 10)
                            {
                                sbrLoans.Append("<td><a href='" + GroupURL + "'>Group 0" + GroupID + "</a></td>");
                            }
                            else
                            {
                                sbrLoans.Append("<td><a href='" + GroupURL + "'>Group " + GroupID + "</a></td>");
                            }


                            if (DaysAgo <= 1)
                            {
                                DaysPlurality = "Day";
                            }

                            sbrLoans.Append("<td>" + AppliedOnLocalDate + " &nbsp;&nbsp;(" + DaysAgo.ToString() + " " + DaysPlurality + " ago)</td>");

                            sbrLoans.Append("<td>" + AppliedBy + "</td>");

                            //the following is for the sake of table sorting where Center 8 > center 10!
                            if (int.Parse(CenterID) < 10)
                            {
                                sbrLoans.Append("<td><a href='" + CenterURL + "'>Center 0" + CenterID + "</a></td>");
                            }
                            else
                            {
                                sbrLoans.Append("<td><a href='" + CenterURL + "'>Center " + CenterID + "</a></td>");
                            }

                            sbrLoans.Append("<td><a href='" + VillageURL + "'>" + Village + "</a></td>");
                            sbrLoans.Append("<td><a href='" + BranchURL + "'>" + Branch + "</a></td>");

                            sbrLoans.Append("</tr>");
                        }
                        sbrLoans.Append("</tbody>");
                        sbrLoans.Append("</table>");

                        PendingLoans.InnerHtml = sbrLoans.ToString();
                    }
                    else
                    {
                        PendingLoans.InnerHtml = UiMsg.LoansPending.NoNewLoans.InfoWrap();
                    }
                }
                else
                {
                    PendingLoans.InnerHtml = UiMsg.Global.NoPageAccess.ErrorWrap();
                }
            }
            else
            {
                PendingLoans.InnerHtml = UiMsg.Global.NoPageAccess.ErrorWrap();
            }
        }
Пример #3
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string PageID = DbSettings.Menus.LoansPending;

            Users          objUsr    = new Users();
            UserKeyDetails objUsrDet = objUsr.GetUserKeyDetails();

            string UserID       = objUsrDet.UserID;
            string UserStatusID = objUsrDet.StatusID;

            string UserRoleID   = objUsrDet.RoleID;
            string UserOfficeID = objUsrDet.OfficeID;

            if (UserID != null && UserStatusID == DbSettings.UserStatus.Active)
            {
                CustEnum.PageAccess Access = objUsr.CheckPageAccess(UserRoleID, PageID);

                if (Access == CustEnum.PageAccess.Yes)
                {
                    //first, check if the group id is valid.
                    string GroupID = null;

                    try
                    {
                        GroupID = (string)Page.RouteData.Values[AppRoutes.DisburseLoans.ValOfficeID];
                    }
                    catch (Exception ex) {}

                    if (GroupID != null)
                    {
                        //check the group status to prevent erroneous operations

                        Loans objLoan = new Loans();

                        DataSet dsLoan = objLoan.GetLafDetails(GroupID);

                        if (!DataUtils.IsDataSetNull(dsLoan, 0))
                        {
                            DataRow drBasicDetails = dsLoan.Tables[0].Rows[0];
                            string  GroupStatusID  = drBasicDetails["GroupStatusID"].ToString();

                            if (GroupStatusID == DbSettings.GroupStatus.New)
                            {
                                //can proceed

                                hdnGID.Value = GroupID;

                                DateTime AppliedOnUTC       = new DateTime();
                                string   AppliedOnLocalDate = string.Empty;

                                AppliedOnUTC       = DateTime.SpecifyKind(DateTime.Parse(drBasicDetails["CreatedDateTime"].ToString()), DateTimeKind.Utc);
                                AppliedOnLocalDate = TimeZoneInfo.ConvertTimeFromUtc(AppliedOnUTC, AppSettings.TimeZoneIst).ToDateShortMonth(true, '-');

                                int DaysAgo;
                                int.TryParse(drBasicDetails["DaysAgo"].ToString(), out DaysAgo);

                                string DaysPlurality = "Days";
                                if (DaysAgo <= 1)
                                {
                                    DaysPlurality = "Day";
                                }

                                string FE = drBasicDetails["FE"].ToString();

                                string CenterID  = drBasicDetails["CenterID"].ToString();
                                string CenterURL = Page.GetRouteUrl(AppRoutes.Center.Name, new { OfficeID = CenterID });

                                string Village    = drBasicDetails["VillageName"].ToString();
                                string VillageURL = Page.GetRouteUrl(AppRoutes.Village.Name, new { OfficeID = drBasicDetails["VillageID"].ToString() });

                                string Branch    = drBasicDetails["BranchName"].ToString();
                                string BranchURL = Page.GetRouteUrl(AppRoutes.BranchOffice.Name, new { OfficeID = drBasicDetails["BranchID"].ToString() });

                                string LoanProdID          = drBasicDetails["LoanProductID"].ToString();
                                string LoanProdName        = drBasicDetails["LoanProduct"].ToString();
                                string LoanProdInt         = drBasicDetails["Interest"].ToString();
                                string LoanProdAmnt        = drBasicDetails["DefualtAmount"].ToString();
                                string LoanProdTenure      = drBasicDetails["Tenure"].ToString();
                                string CollectionTypeID    = drBasicDetails["CollectionTypeID"].ToString();
                                string CollectionFrequency = drBasicDetails["CollectionFrequency"].ToString();

                                //pass vales to ui
                                string GroupURL = Page.GetRouteUrl(AppRoutes.Groups.Name, new { }) + "?" + AppSettings.QueryStr.Group.Name + "=" + GroupID;

                                uxGroupID.InnerHtml   = "<a href='" + GroupURL + "'>Group " + GroupID + "</a>";
                                uxAppliedOn.InnerHtml = AppliedOnLocalDate + " &nbsp;&nbsp;(" + DaysAgo.ToString() + " " + DaysPlurality + " ago)";
                                uxFE.InnerHtml        = FE;
                                uxHierarchy.InnerHtml = "<a href='" + CenterURL + "'>Center " + CenterID + "</a>&nbsp;&nbsp;<i class='icon icon-arrow-right gen-nav-op-1'></i>&nbsp;&nbsp;" + "<a href='" + VillageURL + "'>" + Village + "</a>&nbsp;&nbsp;<i class='icon icon-arrow-right gen-nav-op-1'></i>&nbsp;&nbsp;" + "<a href='" + BranchURL + "'>" + Branch + "</a>";

                                uxLP.InnerHtml       = "<a href='#'>" + LoanProdName + "</a>";
                                uxLpamnt.InnerHtml   = LoanProdAmnt;
                                uxLpInt.InnerHtml    = LoanProdInt;
                                uxLpTenure.InnerHtml = LoanProdTenure;
                                hdnCFTID.Value       = CollectionTypeID;
                                hdnCFV.Value         = CollectionFrequency;


                                //generate client list
                                StringBuilder sbrClients = new StringBuilder();

                                sbrClients.Append("<tr class='template'>");

                                sbrClients.Append("<td colspan='3' class='template-info'>Values entered in this row will be copied to all clients&nbsp; <i class='icon-hand-right'></i></td>");
                                sbrClients.Append("<td><input type='text' class='ldisb-amnt gloAmnt' /></td>");
                                sbrClients.Append("<td><input readonly='readonly' type='text' class='ldisb-date gloDate cmDisbDate' /></td>");
                                sbrClients.Append("<td><input readonly='readonly' type='text' class='lfr-date gloFrDate cmFRDate' /></td>");
                                sbrClients.Append("<td><input type='text' class='span1 gloEMI' /></td>");
                                sbrClients.Append("<td></td>");

                                sbrClients.Append("</tr>");

                                foreach (DataRow dr in dsLoan.Tables[0].Rows)
                                {
                                    string ClientName  = dr["Name"].ToString();
                                    string ClientID    = dr["ClientID"].ToString();
                                    string GroupLeader = dr["IsGroupLeader"].ToString();

                                    string LoanID      = dr["LoanID"].ToString();
                                    string PurposeName = dr["PurposeName"].ToString();
                                    string AmntApplied = dr["AmountApplied"].ToString();

                                    sbrClients.Append("<tr class='cmClientRow' id='LN_" + LoanID + "'>");

                                    if (GroupLeader == "1")
                                    {
                                        sbrClients.Append("<td><a href='#' title='Group Leader' class='label label-info GroupLeader'>" + ClientName + "</a></td>");
                                    }
                                    else
                                    {
                                        sbrClients.Append("<td><a href='#'>" + ClientName + "</a></td>");
                                    }


                                    sbrClients.Append("<td>" + PurposeName + "</td>");
                                    sbrClients.Append("<td>" + AmntApplied + "</td>");
                                    sbrClients.Append("<td><input type='text' class='ldisb-amnt cmDisbAmnt' value='" + AmntApplied + "' /></td>");
                                    sbrClients.Append("<td><input readonly='readonly' type='text' class='ldisb-date cmDisbDate' /></td>");
                                    sbrClients.Append("<td><input readonly='readonly' type='text' class='lfr-date cmFRDate' /></td>");
                                    sbrClients.Append("<td><input type='text' class='span1 cmEMI' /></td>");
                                    sbrClients.Append("<td><a id='RPS_" + LoanID + "' class='ldisb-rps-a'>View Schedule</a></td>");

                                    sbrClients.Append("</tr>");
                                }
                                uxClientList.InnerHtml = sbrClients.ToString();
                            }
                            else
                            {
                                DisburseLoan.InnerHtml = UiMsg.LoansDisbursement.InvalidStatus.ErrorWrap();
                            }
                        }
                        else
                        {
                            DisburseLoan.InnerHtml = UiMsg.LoansDisbursement.NoData.ErrorWrap();
                        }
                    }
                    else
                    {
                        DisburseLoan.InnerHtml = UiMsg.Global.InvalidPage.ErrorWrap();
                    }
                }
                else
                {
                    DisburseLoan.InnerHtml = UiMsg.Global.NoPageAccess.ErrorWrap();
                }
            }
            else
            {
                DisburseLoan.InnerHtml = UiMsg.Global.NoPageAccess.ErrorWrap();
            }
        }