Exemplo n.º 1
0
        public static bool GetCMSCodeValidation(string Group, string code)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().GetCMSCodeValidation(Group, code).Tables[0];
            return(table.Rows.Count > 0);
        }
Exemplo n.º 2
0
        public static bool Get_UserAccess(string Access, string RoleID)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().Get_UserAccess(Access, RoleID).Tables[0];
            return(table.Rows.Count > 0);
        }
Exemplo n.º 3
0
        public static bool ACCodeValidaton(string AcCode)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().ACCodeValidaton(AcCode).Tables[0];
            return(table.Rows.Count > 0);
        }
Exemplo n.º 4
0
        public static bool Idv_Chetana_Get_Validate_PurchaseInvoice(int Invoice, int FY)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().Get_Validate_VirtualInvoice(Invoice, FY).Tables[0];
            return(table.Rows.Count > 0);
        }
Exemplo n.º 5
0
        public void OnGet()
        {
            AdminDataService IfaceAdmin = new AdminDataService();

            PrizeNameList  = IfaceAdmin.GetAllPrizesName();
            PrizeValueList = IfaceAdmin.GetAllPrizesValue();
        }
Exemplo n.º 6
0
        public IActionResult OnPostSubmit()
        {
            bool             isAdmin       = false;
            AdminDataService IAdminService = new AdminDataService();

            TempData.Remove("IsLoggedIn");
            if (UID == "" || UID == null)
            {
                DisplayMessage = $"Error Occured due to ID Field Empty.";
                return(Page());
            }
            if (password == "" || password == null)
            {
                DisplayMessage = $"Error Occured due to Password Field Empty.";
                return(Page());
            }

            if (IAdminService.CheckIsAdmin(UID, password))
            {
                isAdmin = true;
            }
            if (isAdmin)
            {
                TempData.TryAdd("IsLoggedIn", "True");
                return(RedirectToPage("./_Admin"));
            }
            else
            {
                DisplayMessage = "ID/Password Invalid";
                return(Page());
            }
        }
Exemplo n.º 7
0
        public static bool GetOrderNoAuthentication(string OrderNo)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().GetOrderNoAuthentication(OrderNo).Tables[0];
            return((table.Rows.Count > 0) && (table.Rows[0]["OrderNo"].ToString() == OrderNo));
        }
Exemplo n.º 8
0
        public static DataTable Get_AllocateKRA(string EmpCode, int FY, string Flag)
        {
            DataSet   set   = new AdminDataService().Get_AllocateKRA(EmpCode, FY, Flag);
            DataTable table = new DataTable();

            return(set.Tables[0]);
        }
Exemplo n.º 9
0
        public static DataTable Get_TargetMaster(int FY)
        {
            DataSet   set   = new AdminDataService().Get_TargetMaster(FY);
            DataTable table = new DataTable();

            return(set.Tables[0]);
        }
Exemplo n.º 10
0
        public static DataTable GetFinancialYear()
        {
            DataSet financialYear = new DataSet();

            financialYear = new AdminDataService().GetFinancialYear();
            DataTable table = new DataTable();

            return(financialYear.Tables[0]);
        }
Exemplo n.º 11
0
        public static DataTable Get_RoleList()
        {
            DataSet set = new DataSet();

            set = new AdminDataService().Get_RoleList();
            DataTable table = new DataTable();

            return(set.Tables[0]);
        }
Exemplo n.º 12
0
        public static DataTable Get_SectionList()
        {
            DataSet sectionMaster = new DataSet();

            sectionMaster = new AdminDataService().GetSectionMaster();
            DataTable table = new DataTable();

            return(sectionMaster.Tables[0]);
        }
Exemplo n.º 13
0
        public static DataTable GetSDZonemaster()
        {
            DataSet sDZonemaster = new DataSet();

            sDZonemaster = new AdminDataService().GetSDZonemaster();
            DataTable table = new DataTable();

            return(sDZonemaster.Tables[0]);
        }
Exemplo n.º 14
0
        public static DataTable GetBookMaster(string strChetanaCompanyName)
        {
            DataSet bookMaster = new DataSet();

            bookMaster = new AdminDataService().GetBookMaster(strChetanaCompanyName);
            DataTable table = new DataTable();

            return(bookMaster.Tables[0]);
        }
Exemplo n.º 15
0
        public static DataTable GetBookMaster()
        {
            DataSet bookMaster = new DataSet();

            bookMaster = new AdminDataService().GetBookMaster();
            DataTable table = new DataTable();

            return(bookMaster.Tables[0]);
        }
Exemplo n.º 16
0
        public static DataTable GetAreaMaster()
        {
            DataSet areaMaster = new DataSet();

            areaMaster = new AdminDataService().GetAreaMaster();
            DataTable table = new DataTable();

            return(areaMaster.Tables[0]);
        }
Exemplo n.º 17
0
        public static DataTable GetCustomerandTransporter1()
        {
            DataSet customerandTransporter = new DataSet();

            customerandTransporter = new AdminDataService().GetCustomerandTransporter();
            DataTable table = new DataTable();

            return(customerandTransporter.Tables[0]);
        }
Exemplo n.º 18
0
        public static string get_Target_validateh_valid(int empid, string flag1)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().get_Target_validateh_valid(empid, flag1).Tables[0];
            if (table.Rows.Count > 0)
            {
                return(table.Rows[0][0].ToString());
            }
            return("not set!");
        }
Exemplo n.º 19
0
        public static bool Get_DocumentNum_Authentication(int DocumentNo)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().Get_DocumentNum_Authentication(DocumentNo).Tables[0];
            if (table.Rows.Count > 0)
            {
                return((table.Rows[0]["DocumentNo"].ToString() == Convert.ToString(DocumentNo)) && false);
            }
            return(true);
        }
Exemplo n.º 20
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAntiforgery(options => {
                options.HeaderName = "X-XSRF-TOKEN";
            });

            services.AddMvc();

            AdminDataService.RegisterClassMaps();

            DataService.RegisterClassMaps();
            services.AddSingleton(typeof(QuoteService));
            services.AddSingleton(typeof(CalendarService));
            services.AddSingleton(typeof(PageService));
        }
Exemplo n.º 21
0
        /// <summary> 初始化数据库 </summary>
        public static void InitializeDb()
        {
            InitializeAdminDb();

            var adminService = new AdminDataService();
            var dbVersion    = adminService.Query <int>(GlobalKeys.DbVersion);

            if (dbVersion < Const.DbVersion)
            {
                //活动数据库
                InitializeMeetingDb();
                adminService.InsertOrUpdate(GlobalKeys.DbVersion, Const.DbVersion);
            }
            //VersionUpdateSql();
        }
Exemplo n.º 22
0
        public static string Get_UserLogin(string EmpCode, string Password)
        {
            DataTable table = new DataTable();

            table = new AdminDataService().Get_UserLogin(EmpCode, Password).Tables[0];
            if (table.Rows.Count > 0)
            {
                if (table.Rows[0]["Password"].ToString() == Password)
                {
                    return(table.Rows[0]["RoleID"].ToString());
                }
                return(Convert.ToString(0));
            }
            return(Convert.ToString(0));
        }
Exemplo n.º 23
0
        public bool isDelete(string Flag, string Code)
        {
            bool      flag  = false;
            DataTable table = new DataTable();

            table = new AdminDataService().Idv_check_Customer_for_delete(Flag, Code).Tables[0];
            if (Convert.ToInt32(table.Rows[0][0].ToString()) <= 0)
            {
                flag = true;
            }
            else
            {
                flag = false;
            }
            return(false);
        }
Exemplo n.º 24
0
        public IActionResult OnPostDeletePrize()
        {
            TempData.Remove("Action");
            TempData.Remove("Actiontype");
            AdminDataService IfaceAdmin = new AdminDataService();

            PrizeIdList    = IfaceAdmin.GetPrizesId();
            PrizeNameList  = IfaceAdmin.GetAllPrizesName();
            PrizeValueList = IfaceAdmin.GetAllPrizesValue();
            if (PrizeIdList == null || PrizeNameList == null || PrizeValueList == null)
            {
                DisplayMessage = "Error Retrieving Prize List from Database. Connection" +
                                 " to database failed or no prizes exist yet.";
            }
            TempData["Action"]     = "DeletePrize";
            TempData["Actiontype"] = "Prize";
            return(Page());
        }
Exemplo n.º 25
0
        // Activates when Submit button on admin page is clicked.
        public IActionResult OnPostSubmit()
        {
            AdminDataService IfaceAdmin  = new AdminDataService();
            bool             success     = true;
            bool             defaultCase = false;

            TempData.Keep("Action");
            TempData.Keep("Actiontype");

            // Basic error checking, Need to reset TempData as well
            if (UID == "" || UID == null)
            {
                DisplayMessage = $"Error Occurred due to ID/Prize Field Empty.";
                return(Page());
            }
            if (Action == "" || Action == null)
            {
                DisplayMessage = $"Error Occurred due to Action not specified.";
                return(Page());
            }
            if ((ChangeValue <= 0) && !(Action == "AddAccount" || Action == "CheckBalance" || Action == "DeletePrize" || Action == "DeleteAccount"))
            {
                DisplayMessage = $"Error Occurred due Value <= 0. Please enter a valid number.";
                PointMessage   = $"Could not Complete Action, enter a positive number.";
                return(Page());
            }
            if (Actiontype == "User")
            {
                Student            student      = new Student();
                StudentDataService IfaceStudent = new StudentDataService();
                if ((student = IfaceStudent.GetStudentCampusId(UID)) != null)
                {
                    switch (Action)
                    {
                    case "AddAccount":
                        success      = IfaceAdmin.AddAccount(UID);
                        PointMessage = "Student account added successfully.";
                        break;

                    case "CheckBalance":
                        PointMessage = student.total_points.ToString();
                        break;

                    case "IncreasePoint":
                        success      = IfaceAdmin.IncrementPoints(UID, ChangeValue);
                        PointMessage = $" {student.first_name} {student.last_name} has {IfaceAdmin.CheckPoints(UID).ToString()} Points";
                        break;

                    case "DecreasePoint":
                        success = IfaceAdmin.DecrementPoints(UID, ChangeValue);
                        break;

                    case "SetPoint":
                        success = IfaceAdmin.SetPoints(UID, ChangeValue);
                        break;

                    case "DeleteAccount":
                        success = IfaceStudent.DeleteStudent(student.campus_id);
                        break;

                    default:
                        DisplayMessage = $"Error Occurred due to Action variable undefined.";
                        PointMessage   = $"Could not Complete Action";
                        defaultCase    = true;
                        success        = false;
                        break;
                    }

                    if (success)
                    {
                        if (Action != "DeleteAccount")
                        {
                            PointMessage = $" {student.first_name} {student.last_name} has {IfaceAdmin.CheckPoints(UID).ToString()} Points";
                        }
                        DisplayMessage = $"Transaction success with {student.first_name} {student.last_name}";
                    }
                    else if (defaultCase)
                    {
                        // do Nothing
                    }
                    else
                    {
                        DisplayMessage = $"Action Failed due to database operation issue!";
                        PointMessage   = $"Could not Complete Action";
                    }
                }
                else
                {
                    switch (Action)
                    {
                    case "AddAccount":
                        success      = IfaceAdmin.AddAccount(UID);
                        PointMessage = "Student account added successfully.";
                        break;

                    default:
                        DisplayMessage = $"Error Occurred due to Student not found.";
                        break;
                    }
                }
            }
            else if (Actiontype == "Prize")
            {
                switch (Action)
                {
                case "SetPrize":
                    success = IfaceAdmin.UpdatePrizePoints(UID, ChangeValue);
                    break;

                case "AddPrize":
                    success = IfaceAdmin.AddPrize(UID, ChangeValue);
                    break;

                case "DeletePrize":
                    success = IfaceAdmin.DeletePrize(UID);
                    break;

                default:
                    DisplayMessage = $"Error Occurred due to Action variable undefined.";
                    defaultCase    = true;
                    success        = false;
                    break;
                }
                PrizeIdList    = IfaceAdmin.GetPrizesId();
                PrizeNameList  = IfaceAdmin.GetAllPrizesName();
                PrizeValueList = IfaceAdmin.GetAllPrizesValue();
                if (success)
                {
                    PointMessage = $"Transaction Success with Prize {UID}";
                }
                else if (defaultCase)
                {
                    //Do Nothing
                }
                else
                {
                    DisplayMessage = $"Transaction Failed due to database operation issue! Check if Prize is valid.";
                }
            }
            else
            {
                DisplayMessage = $"Action Type Undefinied!";
            }

            return(Page());
        }
Exemplo n.º 26
0
        public static void HandleRequest(HttpListenerContext context)
        {
            try
            {
                HttpListenerRequest request = context.Request;
                string postData             = new StreamReader(request.InputStream, Encoding.UTF8).ReadToEnd();
                byte[] rbytes = HexStringToByteArray(postData);
                object recv   = DeserializeObject(rbytes);
                Console.WriteLine("收到请求:" + recv);
                int id = int.Parse(request.Headers["UserId"]);
                HttpListenerResponse response = context.Response;//响应

                string resp         = "响应";
                string responseBody = objecttostring(resp);
                // UsrInfoService
                UserInfoService UserInfoService = new UserInfoService()
                {
                    UserId = id
                };
                DeliveryDataService DeliveryDataService = new DeliveryDataService()
                {
                    UserId = id
                };
                ApplicationDataService ApplicationDataService = new ApplicationDataService()
                {
                    UserId = id
                };
                DonationDataService DonationDataService = new DonationDataService()
                {
                    UserId = id
                };
                AdminDataService AdminDataService = new AdminDataService()
                {
                    UserId = id
                };
                if (recv is LoginRequest loginRequest)
                {
                    responseBody = objecttostring(UserInfoService.HandleLoginRequest(loginRequest));
                }
                else if (recv is UserInfoRequest userInfoRequest)
                {
                    responseBody = objecttostring(UserInfoService.HandleUserInfoRequest(userInfoRequest));
                }
                else if (recv is RegisterRequest registerRequest)
                {
                    responseBody = objecttostring(UserInfoService.HandleRegisterRequest(registerRequest));
                }
                else if (recv is UserInfoModifyRequest userInfoModifyRequest)
                {
                    responseBody = objecttostring(UserInfoService.HandleModifyRequest(userInfoModifyRequest));
                }
                else if (recv is GetDonationListRequest getDonationListRequest)
                {
                    responseBody = objecttostring(DonationDataService.HandleGetDonationListRequest(getDonationListRequest));
                }
                else if (recv is GetDonationDetailRequest getDonationDetailRequest)
                {
                    responseBody = objecttostring(DonationDataService.HandleGetDonationDetailRequest(getDonationDetailRequest));
                }
                else if (recv is AvailableDonationMaterialRequest availableDonationMaterialRequest)
                {
                    responseBody = objecttostring(DonationDataService.HandleAvailableDonationMaterialRequest(availableDonationMaterialRequest));
                }
                else if (recv is NewDonationRequest newDonationRequest)
                {
                    responseBody = objecttostring(DonationDataService.HandleNewDonationRequest(newDonationRequest));
                }
                else if (recv is CancelDonationRequest cancelDonationRequest)
                {
                    responseBody = objecttostring(DonationDataService.HandleCancelDonationRequest(cancelDonationRequest));
                }

                // DeliveryDataService
                else if (recv is DeliveryListNumRequest deliveryListNumRequest)
                {
                    responseBody = objecttostring(DeliveryDataService.HandleDeliveryListNumRequest(deliveryListNumRequest));
                }
                else if (recv is DeliveryListRequest deliveryListRequest)
                {
                    responseBody = objecttostring(DeliveryDataService.HandleDeliveryListRequest(deliveryListRequest));
                }
                else if (recv is DeliveryMoveRequest deliveryMoveRequest)
                {
                    responseBody = objecttostring(DeliveryDataService.HandleDeliveryMoveRequest(deliveryMoveRequest));
                }
                else if (recv is DeliveryApplyRequest deliveryApplyRequest)
                {
                    responseBody = objecttostring(DeliveryDataService.HandleDeliveryApplyRequest(deliveryApplyRequest));
                }

                else if (recv is AvailableApplicationMaterialRequest availableApplicationMaterialRequest)
                {
                    responseBody = objecttostring(ApplicationDataService.HandleAvailableApplicationMaterialRequest(availableApplicationMaterialRequest));
                }
                else if (recv is GetApplicationDetailRequest getApplicationDetailRequest)
                {
                    responseBody = objecttostring(ApplicationDataService.HandleGetApplicationDetailRequest(getApplicationDetailRequest));
                }
                else if (recv is GetApplicationListRequest getApplicationListRequest)
                {
                    responseBody = objecttostring(ApplicationDataService.HandleGetApplicationListRequest(getApplicationListRequest));
                }
                else if (recv is NewApplicationRequest newApplicationRequest)
                {
                    responseBody = objecttostring(ApplicationDataService.HandleNewApplicationRequest(newApplicationRequest));
                }
                else if (recv is CancelApplicationRequest cancelApplicationRequest)
                {
                    responseBody = objecttostring(ApplicationDataService.HandleCancelApplicationRequest(cancelApplicationRequest));
                }
                else if (recv is ConfirmApplicationDoneRequest confirmApplicationDoneRequest)
                {
                    responseBody = objecttostring(ApplicationDataService.HandleConfirmApplicationDoneRequest(confirmApplicationDoneRequest));
                }
                // AdminDataService
                else if (recv is MaterialAuditAgreeRequest materialAuditAgreeRequest)
                {
                    responseBody = objecttostring(AdminDataService.HandleMaterialAuditAgreeRequest(materialAuditAgreeRequest));
                }
                else if (recv is MaterialAuditListRequest materialAuditListRequest)
                {
                    responseBody = objecttostring(AdminDataService.HandleMaterialAuditListRequest(materialAuditListRequest));
                }
                else if (recv is MaterialAuditRefuseRequest materialAuditRefuseRequest)
                {
                    responseBody = objecttostring(AdminDataService.HandleMaterialAuditRefuseRequest(materialAuditRefuseRequest));
                }
                else if (recv is SecondaryPasswordChangeRequest secondaryPasswordChangeRequest)
                {
                    responseBody = objecttostring(AdminDataService.HandleSecondaryPasswordChangeRequest(secondaryPasswordChangeRequest));
                }
                else
                {
                    System.Diagnostics.Debug.Assert(false);
                }

                response.ContentLength64 = responseBody.Length;
                response.ContentType     = "text/html";
                //输出响应内容
                Stream output = response.OutputStream;
                using (StreamWriter sw = new StreamWriter(output))
                {
                    sw.Write(responseBody);
                    sw.Flush();
                    sw.Close();
                }
                Console.WriteLine("响应结束");
            }
            catch (Exception err)
            {
                Console.WriteLine(err.Message);
            }
        }