Ejemplo n.º 1
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        ID = GetNumber <int>("i");

        if (ID == 0)
        {
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }


        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CodeM_xGetAgencyInfoByID"
                                         , new Dictionary <string, object>()
        {
            { "@OrgID", ID }
        });

        EntityS.FillModel(VM, dt);

        //PageCL CL = new PageCL();
        //tbData = CL.GetList(new List<MedicalCodeVM>(), "ConnUser", "dbo.usp_CodeM_xGetOrgChangeLogListByID",
        //                             new Dictionary<string, object>()
        //                             {
        //                                   { "@OrgID", ID }
        //                            });
    }
Ejemplo n.º 2
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            Dictionary <string, DateTime> dict = new Dictionary <string, DateTime>();
            dict.Add("nowLogin", AuthServer.GetLoginUser().LoginDate);
            nowLogin = JsonConvert.SerializeObject(dict);

            UserID = GetNumber <int>("i");

            DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_AccountM_xGetAccountDetailByID"
                                             , new Dictionary <string, object>()
            {
                { "@UserID", UserID }
            });

            VM = new AccountDetailVM();
            EntityS.FillModel(VM, dt);
            ApplyDate = VM.ApplyDate.ToShortTaiwanDate();
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 3
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);

        UC_OpenSelectSingleOrg.PageUrl    = "/Report/WorkloadM/WorkloadStatistics.aspx";
        UC_OpenSelectSingleOrg.IsRequired = true;

        var dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetVaccineList"
                                   , new Dictionary <string, object>()
        {
        });

        List <AddVaccineVM> list = new List <AddVaccineVM>();

        EntityS.FillModel(list, dt);

        if (list.Count > 0)
        {
            foreach (var item in list)
            {
                var li = new ListItem();
                li.Text  = string.Format("{0} ({1})", item.VaccineID, item.VaccineCName);
                li.Value = item.VaccineID;
                ddlVaccSelect.Items.Add(li);
            }
        }
    }
Ejemplo n.º 4
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);

        UC_OpenSelectSingleOrg.PageUrl  = "/Vaccination/CertificateM/SignSetting.aspx";
        UC_OpenSelectSingleOrg.callback = "onSelectSingleOrg();";

        user = AuthServer.GetLoginUser();

        if (this.IsPostBack == false)
        {
            DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetCertificateSignByOrgID"
                                             , new Dictionary <string, object>()
            {
                { "@OrgID", user.OrgID }
            });

            if (dt.Rows.Count > 0)
            {
                CertificateSignVM VM = new CertificateSignVM();
                EntityS.FillModel(VM, dt);
                tbP.Text = VM.PhysicianSignature;
                tbE.Text = VM.EnglishFullTitle;
                tbC.Text = VM.ChineseFullTitle;
                tbD.Text = VM.UnitDirector;
                tbS.Text = VM.UnitStamp;

                UC_OpenSelectSingleOrg.DefaultName = VM.OrgName;
                UC_OpenSelectSingleOrg.DefaultID   = VM.OrgID;
                //tbLocation.Text = VM.OrgName;
                //hfLocationID.Value = VM.OrgID.ToString();
            }
        }
    }
Ejemplo n.º 5
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        ID = GetNumber <int>("ii");

        if (ID == 0)
        {
            IsValid = false;
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        if (this.IsPostBack == false)
        {
            DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CodeM_xGetSystemCodeCateByID"
                                             , new Dictionary <string, object>()
            {
                { "@SystemCodeCateID", ID }
            });
            SystemCodeCateVM VM = new SystemCodeCateVM();
            EntityS.FillModel(VM, dt);
            lblCate.Text = VM.CodeDescription;
        }
    }
Ejemplo n.º 6
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);

        AddPower = base.GetPower(list[1]);

        if (Request.HttpMethod.Equals("POST"))
        {
            ID = GetNumber <int>("i");
        }
        else
        {
            ID = GetNumber <int>("i", MyHttpMethod.GET);
        }

        if (ID == 0)
        {
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CodeM_xGetSystemCodeListByCateID"
                                         , new Dictionary <string, object>()
        {
            { "@SystemCodeCateID", ID }
        });

        EntityS.FillModel(VM, dt);
    }
Ejemplo n.º 7
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        user = AuthServer.GetLoginUser();

        if (this.IsPostBack == false)
        {
            DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_AccountM_xGetUserInfoByID"
                                             , new Dictionary <string, object>()
            {
                { "@UserID", user.ID }
            });

            UserVM user2 = new UserVM();
            EntityS.FillModel(user2, dt);

            lblAccount.Text = user.LoginName;
            tbDept.Text     = user.OrgName;
            tbIDF.Text      = user2.RocID;
            tbName.Text     = user2.UserName;
            tbEmail.Text    = user2.Email;
            tbTitle.Text    = user2.Title;
            tbTel.Text      = user2.PhoneNumber;
        }
    }
Ejemplo n.º 8
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);
        base.BodyClass = "top";

        UserVM user = AuthServer.GetLoginUser();

        txtLogin1 = string.Format("{0}({1}, {2})"
                                  , user.UserName
                                  , user.LoginName
                                  , user.OrgName);
        txtLogin2 = string.Format("於{0} 由 {1} 登入"
                                  , user.LoginDate.ToShortTaiwanDateTime()
                                  , IpAddressS.GetIP());

        if (WebConfigurationManager.AppSettings["SystemPowerCateID"] != null)
        {
            SystemPowerCateID = Convert.ToInt32(WebConfigurationManager.AppSettings["SystemPowerCateID"]);
        }

        DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_SystemM_xGetTotalOnlineUserByCateID"
                                         , new Dictionary <string, object>()
        {
            { "@SystemPowerCateID", SystemPowerCateID }
        });

        if (dt.Rows.Count > 0)
        {
            txtLogin3 = "線上人數: " + dt.Rows[0][0].ToString() + " 人";
        }
    }
Ejemplo n.º 9
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            CaseUserID = GetNumber <int>("c");
            List <string> VaccineList = GetList <string>("a");

            var dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetVaccineList"
                                       , new Dictionary <string, object>()
            {
            });

            List <AddVaccineVM> list = new List <AddVaccineVM>();
            EntityS.FillModel(list, dt);

            var listDiff = list.Where(item => (VaccineList.Contains(item.VaccineID) == false));
            if (listDiff.Count() > 0)
            {
                tbAry = JsonConvert.SerializeObject(listDiff);
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 10
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        AddPower = base.GetPower(list[1]);

        ID = GetNumber <int>("i");

        if (ID == 0)
        {
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CodeM_xGetSystemCodeListByCateID"
                                         , new Dictionary <string, object>()
        {
            { "@SystemCodeCateID", ID }
        });

        EntityS.FillModel(VM, dt);

        //PageCL CL = new PageCL();
        //tbData = CL.GetList(new List<SystemCodeVM>(), "ConnDB", "dbo.usp_CodeM_xGetEnabledSystemCodeList",
        //                                 new Dictionary<string, object>()
        //                                 {
        //                                       { "@SystemCodeCateID",  ID },
        //                                       { "@EnState",  0 },
        //                                       { "@pgNow",1},
        //                                       { "@pgSize", 10}
        //                                });
    }
Ejemplo n.º 11
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(false);

        int ID = GetNumber <int>("i");

        DownloadVM VM = new DownloadVM(ID);

        var user = AuthServer.GetLoginUser();

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_FileM_xGetFileInfoByID"
                                         , new Dictionary <string, object>()
        {
            { "@ID", VM.ID },
            { "@OrgID", user.OrgID }
        });

        if (dt.Rows.Count > 0)
        {
            string Json = JsonConvert.SerializeObject(VM);
            string code = QueryStringEncryptToolS.Encrypt(Json);
            Response.Redirect(WebConfigurationManager.AppSettings["FileServerURL"] + "/livestorage.aspx?o=" + HttpUtility.UrlEncode(code));
            Response.End();
        }
        else
        {
            Response.Redirect("~/html/ErrorPage/NoPower.html");
        }
    }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        int VaccineID = GetNumber <int>("i");

        if (VaccineID == 0)
        {
            string script = "<script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_ParameterM_xGetDefaultBatchByVaccineDataID"
                                         , new Dictionary <string, object>()
        {
            { "@VaccineDataID", VaccineID }
        });

        List <BatchSettingVM> list = new List <BatchSettingVM>();

        EntityS.FillModel(list, dt);

        List <BatchSettingVM> outList = new List <BatchSettingVM>();
        var indexList = new List <Tuple <int, int> >();

        foreach (var item in list)
        {
            bool HasValue = false;
            int  index    = 0;
            indexList.ForEach((innerItem) => {
                if (HasValue == false)
                {
                    if (innerItem.Item1 == item.VaccineBatchID)
                    {
                        HasValue = true;
                    }
                    else
                    {
                        index++;
                    }
                }
            });
            if (HasValue == false)
            {
                outList.Add(item);
                indexList.Add(Tuple.Create(item.VaccineBatchID, outList.Count - 1));
            }
            else
            {
                outList[index].StorageBottle += item.StorageBottle;
            }
        }

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(JsonConvert.SerializeObject(outList));
        Response.End();
    }
Ejemplo n.º 13
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");

        string AccountOrName = GetString("an");
        string OrgName       = GetString("on");
        int    CheckState    = GetNumber <int>("cs");
        int    pgNow         = GetNumber <int>("pgNow");
        int    pgSize        = GetNumber <int>("pgSize");

        DataSet ds = MSDB.GetDataSet("ConnUser", "dbo.usp_AccountM_xGetUserListByMany"
                                     , new Dictionary <string, object>()
        {
            { "@AccountOrName", AccountOrName },
            { "@OrgName", OrgName },
            { "@CheckState", CheckState },
            { "@pgNow", pgNow == 0 ? 1 : pgNow },
            { "@pgSize", pgSize == 0 ? 10 : pgSize },
        });

        List <UserInfoVM> list = new List <UserInfoVM>();
        PageVM            rtn  = new PageVM();

        EntityS.FillModel(list, ds.Tables[0]);
        EntityS.FillModel(rtn, ds.Tables[1]);

        var    IDs       = list.Select(item => item.ID);
        string IDsString = string.Join(",", IDs);

        DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_AccountM_xGetUserRolesByIDs"
                                         , new Dictionary <string, object>()
        {
            { "@IDs", IDsString.Length == 0 ? "0" : IDsString }
        });

        List <UserRoleVM> VMs = new List <UserRoleVM>();

        EntityS.FillModel(VMs, dt);

        foreach (var item in list)
        {
            foreach (var VM in VMs)
            {
                if (item.ID == VM.UserID)
                {
                    item.RoleIdList.Add(VM.RoleID);
                }
            }
        }

        rtn.message = list;

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }
    private string GetMenu()
    {
        List <ModuleMenuVM> list = new List <ModuleMenuVM>();
        DataTable           dt   = MSDB.GetDataTable("ConnUser", "dbo.usp_SystemM_xGetModuleMenu"
                                                     , new Dictionary <string, object>()
        {
            { "@UserID", 1 },
            { "@ModuleCateID", RoleCateID }
        });

        EntityS.FillModel(list, dt);
        return(JsonConvert.SerializeObject(list));
    }
Ejemplo n.º 15
0
    private string GetMenu(UserVM user)
    {
        //ModuleMenuVM lastNode = null;
        List <ModuleMenuVM> list = new List <ModuleMenuVM>();
        //List<ModuleMenuVM> Rtn = new List<ModuleMenuVM>();

        int ModuleCateID = 1;

        if (WebConfigurationManager.AppSettings["ModuleCateID"] != null)
        {
            ModuleCateID = Convert.ToInt32(WebConfigurationManager.AppSettings["ModuleCateID"]);
        }

        DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_SystemM_xGetModuleMenu"
                                         , new Dictionary <string, object>()
        {
            { "@UserID", user.ID },
            { "@ModuleCateID", ModuleCateID }
        });

        EntityS.FillModel(list, dt);

        //foreach (ModuleMenuVM item in list)
        //{

        //    if (item.PID == 0)
        //    {
        //        Rtn.Add(item);
        //        lastNode = item;
        //    }
        //    else
        //    {
        //        if (lastNode != null)
        //        {

        //            if (lastNode.ID == item.PID)
        //            {
        //                lastNode.children.Add(item);
        //            }
        //            else
        //            {

        //                GenMenuRecursive(item, lastNode);
        //            }
        //        }
        //    }
        //}

        //return JsonConvert.SerializeObject(Rtn);
        return(JsonConvert.SerializeObject(list));
    }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        user = AuthServer.GetLoginUser();

        if (Request.HttpMethod.Equals("POST"))
        {
            ID         = GetNumber <int>("c");
            FluNotesID = GetNumber <int>("i");

            if (ID == 0 && FluNotesID == 0)
            {
                IsValid = false;
                string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');window.close();</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                return;
            }


            if (this.IsPostBack == false)
            {
                if (FluNotesID == 0)
                {
                    tbDate.Text = DateTime.Now.ToShortTaiwanDate();
                }
                else
                {
                    DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetFluNotesByID"
                                                     , new Dictionary <string, object>()
                    {
                        { "@FluNotesID", FluNotesID }
                    });

                    RegisterFluNotesVM VM = new RegisterFluNotesVM();
                    EntityS.FillModel(VM, dt);

                    tbDate.Text = VM.InoculationDate.ToShortTaiwanDate();
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");

        var user = AuthServer.GetLoginUser();

        var dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetSchoolCodeByOrgID"
                                   , new Dictionary <string, object>()
        {
            { "@OrgID", user.OrgID }
        });

        Response.ContentType = "application/download";
        Response.AddHeader("Content-Disposition", string.Format("attachment; filename=" + HttpUtility.UrlEncode("範本-學校代碼.xls")));
        ExcelToolT tool = new ExcelToolT();

        tool.RenderDataTableToExcel(dt).CopyTo(Response.OutputStream);
        Response.End();
    }
Ejemplo n.º 18
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);


        UpdatePower = base.GetPower(list[1]);

        CateID = GetNumber <int>("ci");
        ID     = GetNumber <int>("i");

        if (ID == 0 || CateID == 0)
        {
            IsValid = false;
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        if (this.IsPostBack == false)
        {
            DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CodeM_xGetSystemCodeByID"
                                             , new Dictionary <string, object>()
            {
                { "@SystemCodeID", ID }
            });

            EntityS.FillModel(VM, dt);
            lblCate.Text  = VM.CodeDescription;
            lblValue.Text = VM.EnumValue.ToString();
            tbName.Text   = VM.EnumName;
            if (VM.IsEnabled)
            {
                rb1.Checked = true;
            }
            else
            {
                rb2.Checked = true;
            }
        }
    }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        OrgID = GetNumber <int>("o");

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CertificateM_xGetCertificateSignByOrgID"
                                         , new Dictionary <string, object>()
        {
            { "@OrgID", OrgID }
        });

        CertificateSignVM VM = new CertificateSignVM();

        EntityS.FillModel(VM, dt);
        VM.OrgID             = OrgID;
        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(JsonConvert.SerializeObject(VM));
        Response.End();
    }
Ejemplo n.º 20
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            var user = AuthServer.GetLoginUser();

            CaseUserID = GetNumber <int>("i");

            if (CaseUserID == 0)
            {
                IsValid = false;
                string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                return;
            }

            if (this.IsPostBack == false)
            {
                DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CertificateM_xGetCaseUserNameByID"
                                                 , new Dictionary <string, object>()
                {
                    { "@CaseUserID", CaseUserID }
                });

                if (dt.Rows.Count > 0)
                {
                    tbName.Text = dt.Rows[0]["ChName"].ToString();
                    tbE.Text    = dt.Rows[0]["EnName"].ToString();
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 21
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            nowDate                 = DateTime.Now.ToShortTaiwanDate();
            CaseUserID              = GetNumber <int>("c");
            RecordDataID            = GetNumber <int>("i");
            SystemRecordVaccineCode = GetString("r");
            SystemRecordVaccineID   = GetNumber <int>("ri");
            AppointmentDate         = GetString("a");
            UpdateUID               = GetNumber <int>("uu");

            DateTime date    = default(DateTime);
            bool     success = DateTime.TryParse(AppointmentDate, out date);
            AppointmentDate = date.ToShortTaiwanDate();

            lblVC.Text = SystemRecordVaccineCode;
            lblAD.Text = success ? AppointmentDate :"";
            var user = AuthServer.GetLoginUser();

            Agency   = user.OrgName;
            AgencyID = user.OrgID;

            if (UpdateUID == 0)
            {
                if (CaseUserID == 0 || RecordDataID == 0)
                {
                    string script = "<script>alert('資料取得失敗');window.close();</script>";
                    Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                    return;
                }
            }


            if (SystemCode.dict.ContainsKey("RecordM_ApplyHealthCate"))
            {
                StateListAry = JsonConvert.SerializeObject(SystemCode.dict["RecordM_ApplyHealthCate"].OrderBy(item => item.OrderNumber));
            }

            UserName = user.UserName;

            DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_AccountM_xGetUserListByOrgID"
                                             , new Dictionary <string, object>()
            {
                { "@OrgID", user.OrgID }
            });

            List <UserNameIDVM> list = new List <UserNameIDVM>();

            EntityS.FillModel(list, dt);

            UserAry = JsonConvert.SerializeObject(list);


            if (UpdateUID > 0)
            {
                dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetApplyHealthByID"
                                       , new Dictionary <string, object>()
                {
                    { "@ID", UpdateUID }
                });

                ApplyHealthVM VM = new ApplyHealthVM();
                EntityS.FillModel(VM, dt);

                UpdateUserData = JsonConvert.SerializeObject(VM);
                nowDate        = VM.AssessmentDate.ToShortTaiwanDate();
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        if (Page.PreviousPage != null)
        {
            if (PreviousPage.IsCrossPagePostBack == true)
            {
                System_PowerM_RolePowerSetting_Add page = (System_PowerM_RolePowerSetting_Add)PreviousPage;
                RoleName        = PureString(page.RoleName);
                RoleDescription = PureString(page.RoleDescription);
                int RoleLevel = page.RoleLevel;
                RoleLevelName = PureString(page.RoleLevelName);

                int tmRoleCateID = GetNumber <int>("hfCateID");
                if (tmRoleCateID == 0)
                {
                    tmRoleCateID = 1;
                }

                RoleCateID   = tmRoleCateID;
                RoleCateName = GetString("hfCateName");

                if (RoleName.Length == 0)
                {
                    Response.Redirect("~/System/PowerM/RolePowerSetting_Add.aspx");
                }
                else
                {
                    MyTreeData = GetMenu();
                }

                var user = AuthServer.GetLoginUser();

                Dictionary <string, object> OutDict = new Dictionary <string, object>()
                {
                    { "@OutRoleID", OutRoleID }
                };

                MSDB.ExecuteNonQuery("ConnUser", "dbo.usp_PowerM_xAddRole"
                                     , ref OutDict
                                     , new Dictionary <string, object>()
                {
                    { "@RoleName", RoleName },
                    { "@RoleLevel", RoleLevel },
                    { "@RoleDescription", RoleDescription },
                    { "@RoleCateID", RoleCateID },
                    { "@CreatedUserID", user.ID }
                });

                OutRoleID = (int)OutDict["@OutRoleID"];

                string script = "";

                if (OutRoleID <= 0)
                {
                    script = "<script>alert('儲存失敗');location.href = '/System/PowerM/RolePowerSetting.aspx';</script>";
                    Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                }
                else
                {
                    hfR.Value = OutRoleID.ToString();
                }
            }
        }
        else if (this.IsPostBack == true)
        {
            MyTreeData = GetMenu();

            DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_PowerM_xGetRoleByID"
                                             , new Dictionary <string, object>()
            {
                { "@ID", int.Parse(hfR.Value) }
            });
            RolePowerSettingVM VM = new RolePowerSettingVM();
            EntityS.FillModel(VM, dt);

            RoleName        = VM.RoleName;
            RoleDescription = VM.RoleDescription;
            int RoleLevel = VM.RoleLevel;
            switch (VM.RoleLevel)
            {
            case 1:
                RoleLevelName = "中央";
                break;

            case 2:
                RoleLevelName = "區管中心";
                break;

            case 3:
                RoleLevelName = "局";
                break;

            case 4:
                RoleLevelName = "所";
                break;
            }
        }
        else
        {
            Response.Redirect("~/System/PowerM/RolePowerSetting_Add.aspx");
        }
    }
Ejemplo n.º 23
0
    protected override void OnInitComplete(EventArgs e)
    {
        if (BreakCheckPower == true)
        {
            return;
        }

        bool HasPower = false;

        if (Request.UrlReferrer == null || Request.Url.Host.Equals(Request.UrlReferrer.Host) == false)
        {
            //throw new HttpException(404, "Not found");
            Response.Redirect("/Login.aspx");
            Response.End();
        }

        UserVM user = AuthServer.GetLoginUser();

        if (user != null)
        {
            string path = Request.FilePath.ToLower();

            if (path.Equals("/home.aspx") == true || path.Equals("/leftmenu.aspx") == true || path.Equals("/topheader.aspx") == true)
            {
                HasPower = true;
            }
            else
            {
                if (dict.Count > 0)
                {
                    var dictHasPowerCount = 0;

                    List <string> allUrlList        = new List <string>();
                    List <string> notAddUrlList     = new List <string>();
                    List <string> PageUrlList       = new List <string>();
                    List <string> FunctionIndexList = new List <string>();

                    foreach (var item in dict)
                    {
                        PageUrlList.Add(item.Key.PageUrl);
                        FunctionIndexList.Add(((int)item.Key.myPowerEnum).ToString());

                        if (allUrlList.Contains(item.Key.PageUrl) == false)
                        {
                            allUrlList.Add(item.Key.PageUrl);
                        }

                        if (item.Key.myPowerEnum == MyPowerEnum.瀏覽)
                        {
                            if (notAddUrlList.Contains(item.Key.PageUrl) == false)
                            {
                                notAddUrlList.Add(item.Key.PageUrl);
                            }
                        }
                    }

                    var needAddUrlList = allUrlList.Except(notAddUrlList);

                    foreach (var item in needAddUrlList)
                    {
                        PageUrlList.Add(item);
                        FunctionIndexList.Add(((int)MyPowerEnum.瀏覽).ToString());
                    }

                    var dt = MSDB.GetDataTable("ConnUser", "dbo.usp_SystemM_xCheckPowerList"
                                               , new Dictionary <string, object>()
                    {
                        { "@UserID", user.ID },
                        { "@PageUrls", string.Join(",", PageUrlList) },
                        { "@FunctionIndexs", string.Join(",", FunctionIndexList) },
                        { "@ModuleCateID", Convert.ToInt32(WebConfigurationManager.AppSettings["ModuleCateID"]) }
                    });

                    int i = 0;
                    foreach (var item in dict)
                    {
                        bool itemPower = (bool)dt.Rows[i][0];
                        if (isSharedPage == false && item.Key.myPowerEnum == MyPowerEnum.瀏覽 && itemPower == false)
                        {
                            HasPower = false;
                            break;
                        }
                        else if (isSharedPage == true)
                        {
                            if (SharedPageCheckUrl.Length > 0)
                            {
                                HasPower = CheckPower(SharedPageCheckUrl, MyPowerEnum.瀏覽);
                            }
                            else
                            {
                                HasPower = CheckPower(Request.Path, MyPowerEnum.瀏覽);
                            }

                            if (HasPower == false)
                            {
                                break;
                            }
                        }
                        else
                        {
                            item.Value.HasPower = itemPower;
                            HasPower            = true;
                        }

                        if (itemPower == true)
                        {
                            dictHasPowerCount++;
                        }

                        i++;
                    }

                    if (HasPower == true)
                    {
                        if ((dictHasPowerCount == dict.Count) || (powerLogicType == PowerLogicType.OR && dictHasPowerCount >= 1))
                        {
                            HasPower = true;
                        }
                        else
                        {
                            HasPower = false;
                        }
                    }
                }
                else
                {
                    HasPower = CheckPower(Request.Path, MyPowerEnum.瀏覽);
                }
            }

            if (HasPower == false)
            {
                throw new HttpException(404, "Not found");
            }
        }
        else
        {
            throw new HttpException(404, "Not found");
        }
    }
Ejemplo n.º 24
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            CaseUserID              = GetNumber <int>("c");
            RecordDataID            = GetNumber <int>("i");
            SystemRecordVaccineCode = GetString("r");
            SystemRecordVaccineID   = GetNumber <int>("ri");
            AppointmentDate         = GetString("a");
            AppointmentDate         = AppointmentDate.Length == 0 ? GetString("aa") ?? "" : AppointmentDate;
            DateTime date    = default(DateTime);
            bool     success = DateTime.TryParse(AppointmentDate, out date);
            AppointmentDate = date.ToShortTaiwanDate();
            UpdateUID       = GetNumber <int>("uu");

            user = AuthServer.GetLoginUser();

            DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetDefaultBatchVaccineByOrgIDVaccineID"
                                             , new Dictionary <string, object>()
            {
                { "@OrgID", user.OrgID },
                { "@VaccineID", SystemRecordVaccineCode.Split('-')[0] }
            });

            List <DefaultBatchVaccineVM> list = new List <DefaultBatchVaccineVM>();
            EntityS.FillModel(list, dt);

            if (list.Count > 0)
            {
                tbAry = JsonConvert.SerializeObject(list);
            }

            Agency   = user.OrgName;
            AgencyID = user.OrgID;

            if (this.IsPostBack == false)
            {
                lblVC.Text = SystemRecordVaccineCode;
                lblAD.Text = AppointmentDate;
                //hfc.Value = CaseUserID.ToString();
                //hfi.Value = RecordDataID.ToString();
                //hfr.Value = SystemRecordVaccineCode;
                //hfa.Value = AppointmentDate;

                if (UpdateUID == 0)
                {
                    if (success == false || CaseUserID == 0 || RecordDataID == 0)
                    {
                        IsValid = false;
                        string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');window.close();</script>";
                        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                        return;
                    }
                }

                tbDate.Text = DateTime.Now.ToShortTaiwanDate();


                if (SystemCode.dict.ContainsKey("RecordM_ApplyRecord_ReSignReason"))
                {
                    var codes = SystemCode.dict["RecordM_ApplyRecord_ReSignReason"];

                    ddlReason1.Items.Add(new ListItem("請選擇", ""));

                    foreach (var item in codes)
                    {
                        ddlReason1.Items.Add(new ListItem(item.EnumName, item.EnumValue.ToString()));
                    }
                }

                if (SystemCode.dict.ContainsKey("RecordM_ApplyRecord_ReInoculationReason"))
                {
                    var codes = SystemCode.dict["RecordM_ApplyRecord_ReInoculationReason"];

                    ddlReason2.Items.Add(new ListItem("請選擇", ""));

                    foreach (var item in codes)
                    {
                        ddlReason2.Items.Add(new ListItem(item.EnumName, item.EnumValue.ToString()));
                    }
                }

                if (SystemCode.dict.ContainsKey("RecordM_ApplyRecord_EarlyLateReason"))
                {
                    var codes = SystemCode.dict["RecordM_ApplyRecord_EarlyLateReason"];

                    ddlReason3.Items.Add(new ListItem("請選擇", ""));

                    foreach (var item in codes)
                    {
                        ddlReason3.Items.Add(new ListItem(item.EnumName, item.EnumValue.ToString()));
                    }
                }

                if (UpdateUID > 0)
                {
                    dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetApplyRecordByID"
                                           , new Dictionary <string, object>()
                    {
                        { "@ID", UpdateUID }
                    });

                    ApplyRecordVM VM = new ApplyRecordVM();
                    EntityS.FillModel(VM, dt);

                    ddlReason1.SelectedValue = VM.ReSignReason.ToString();
                    ddlReason2.SelectedValue = VM.ReInoculationReason.ToString();
                    ddlReason3.SelectedValue = VM.EarlyLateReason.ToString();

                    var ary = VM.ReasonString.Split(',');
                    if (ary.Length > 0)
                    {
                        tbReason1.Text = ary[0];
                    }
                    if (ary.Length > 1)
                    {
                        tbReason2.Text = ary[1];
                    }
                    if (ary.Length > 0)
                    {
                        tbReason3.Text = ary[2];
                    }

                    cbSI.Checked = VM.SpecialInoculation;
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(true);

        ViewPower   = base.GetPower(PowerList[0]);
        UpdatePower = base.GetPower(PowerList[1]);

        if (Request.HttpMethod.Equals("POST"))
        {
            if (UpdatePower.HasPower == false)
            {
                tbName.Enabled = false;
                tbDesp.Enabled = false;
                rb1.Enabled    = false;
                rb2.Enabled    = false;
                rb3.Enabled    = false;
                rb4.Enabled    = false;
            }

            ID = GetNumber <int>("i");

            if (this.IsPostBack == false)
            {
                if (ID == 0)
                {
                    IsValid = false;
                    string script = "<script>alert('資料取得失敗');history.go(-1);</script>";
                    Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                    return;
                }

                DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_PowerM_xGetRoleByID"
                                                 , new Dictionary <string, object>()
                {
                    { "@ID", ID }
                });

                RolePowerSettingVM VM = new RolePowerSettingVM();
                EntityS.FillModel(VM, dt);

                tbName.Text = VM.RoleName;
                tbDesp.Text = VM.RoleDescription;
                switch (VM.RoleLevel)
                {
                case 1:
                    rb1.Checked = true;
                    break;

                case 2:
                    rb2.Checked = true;
                    break;

                case 3:
                    rb3.Checked = true;
                    break;

                case 4:
                    rb4.Checked = true;
                    break;
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 26
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(false);

        CaseUserID = GetNumber <int>("i");

        if (CaseUserID == 0)
        {
            string script = "<style>body{disply:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        ucCaseRemark1.CaseID = CaseUserID;
        var user = AuthServer.GetLoginUser();

        OrgName = user.OrgName;

        DataTable dt          = new DataTable();
        int       YCardMainID = 0;
        int       DeltaDays   = 0;
        Dictionary <string, object> OutDict = new Dictionary <string, object>()
        {
            { "@YCardMainID", YCardMainID },
            { "@DeltaDays", DeltaDays }
        };

        DataSet ds = MSDB.GetDataSet("ConnDB", "dbo.usp_RecordM_xGetCaseUserByIDAndGetOrAddYCardMain"
                                     , ref OutDict
                                     , new Dictionary <string, object>()
        {
            { "@CaseUserID", CaseUserID }
        });

        YCardMainID = (int)OutDict["@YCardMainID"];
        DeltaDays   = (int)OutDict["@DeltaDays"];

        List <RegisterStoolCardVM> scList = new List <RegisterStoolCardVM>();
        List <RegisterFluNotesVM>  fnList = new List <RegisterFluNotesVM>();
        string CapacityIDs = "";

        EntityS.FillModel(VM, ds.Tables[0]);
        if (ds.Tables[2].Rows.Count > 0)
        {
            EntityS.FillModel(VM, ds.Tables[2]);
            VM.HasYellowCardMessage = true;
        }
        EntityS.FillModel(scList, ds.Tables[3]);
        EntityS.FillModel(fnList, ds.Tables[4]);

        if (ds.Tables[1].Rows.Count > 0)
        {
            CapacityIDs = ds.Tables[1].Rows[0][0].ToString();
        }

        if (scList.Count > 0)
        {
            scAry = JsonConvert.SerializeObject(scList);
        }

        if (fnList.Count > 0)
        {
            fnAry = JsonConvert.SerializeObject(fnList);
        }

        List <string> CapacityList = new List <string>();

        foreach (var item in CapacityIDs.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries))
        {
            CapacityList.Add(SystemCode.GetName("CaseUser_Capacity", int.Parse(item)));
        }

        CapacityString = string.Join(",", CapacityList.ToArray());

        //if(ds.Tables[1].Rows.Count>0)
        //    YCardMainID = (int)ds.Tables[1].Rows[0][0];



        uJson = JsonConvert.SerializeObject(VM);

        AgeCalculatorT AT = new AgeCalculatorT();

        AgeString = AT.GetYearMonthAge(VM.BirthDate);


        DateTime birthDate = VM.BirthDate;

        dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetRecordDataByCaseUserID"
                               , new Dictionary <string, object>()
        {
            { "@CaseUserID", CaseUserID }
        });

        List <RecordDataVM> list = new List <RecordDataVM>();

        //List<RecordYellowDataVM> yellowList = new List<RecordYellowDataVM>();
        var yellowList = SystemYCard.GetDict(YCardMainID).Where(item => item.YCardDataType == 1);
        //var x = SystemYCard.dict;
        List <RecordUserDataVM> userList = new List <RecordUserDataVM>();

        //List<RecordYellowDataVM> yellowRemoveList = new List<RecordYellowDataVM>();
        List <RecordUserDataVM> userRemoveList = new List <RecordUserDataVM>();

        EntityS.FillModel(userList, dt);

        //EntityS.FillModel(yellowList, ds.Tables[0]);
        //EntityS.FillModel(userList, ds.Tables[1]);

        //var userVaccineCodes =userList.Select(item => item.SystemRecordVaccineCode).ToList();
        //var DoseIDs = yellowList.Select(item => item.DoseID).ToList();



        foreach (var yellow in yellowList)
        {
            var queryList = userList.FindAll(item => item.SystemRecordVaccineCode.Equals(yellow.DoseID));

            if (queryList.Count > 0)
            {
                foreach (var q in queryList)
                {
                    //yellowRemoveList.Add(yellow);
                    userRemoveList.Add(q);
                    RecordDataVM rVM = new RecordDataVM(birthDate);
                    rVM.InoculationDate       = q.InoculationDate;
                    rVM.IsRule                = true;
                    rVM.OrgID                 = q.OrgID;
                    rVM.VaccineBatchID        = q.VaccineBatchID;
                    rVM.SystemRecordVaccineID = q.SystemRecordVaccineID;
                    rVM.AgeEngilsh            = yellow.AgeEngilsh;
                    rVM.DoseID                = yellow.DoseID;
                    rVM.Period                = yellow.Period;
                    rVM.CreatedDate           = q.CreatedDate;
                    rVM.CreateType            = q.CreateType;
                    //rVM.ColorType = 1;
                    rVM.RecordDataID = q.RecordDataID;


                    //if (rVM.InoculationDate == null || DateTime.Equals(rVM.InoculationDate, new DateTime(2099, 1, 1, 1, 1, 1, 0)))
                    //{
                    //    rVM.OrgID = 0;
                    //    rVM.ColorType = 0;
                    //    rVM.CreatedDate = null;
                    //}
                    //else if(rVM.AppointmentDate!=null && DateTime.Equals(rVM.InoculationDate, new DateTime(2099, 1, 1, 1, 1, 1, 0))==false)
                    //{
                    //   if(DateTime.Compare(rVM.InoculationDate.Value, rVM.AppointmentDate.Value.AddDays(90))>0)
                    //    {
                    //        rVM.ColorType = 1;
                    //    }
                    //}

                    list.Add(rVM);
                }
            }
            else
            {
                RecordDataVM rVM = new RecordDataVM(birthDate);
                rVM.IsRule     = true;
                rVM.AgeEngilsh = yellow.AgeEngilsh;
                rVM.DoseID     = yellow.DoseID;
                //rVM.SystemRecordVaccineID = SystemRecordVaccine.GetID(yellow.DoseID);
                rVM.Period = yellow.Period;
                //rVM.ColorType = 0;
                list.Add(rVM);
            }
        }

        //yellowList.RemoveAll(item => yellowRemoveList.Contains(item));

        userList.RemoveAll(item => userRemoveList.Contains(item));

        list.OrderBy(item => item.AppointmentDate).ThenBy(item => item.Period).ThenBy(item => item.DoseID);

        foreach (var u in userList)
        {
            RecordDataVM rVM = new RecordDataVM(birthDate);
            rVM.InoculationDate       = u.InoculationDate;
            rVM.IsRule                = false;
            rVM.OrgID                 = u.OrgID;
            rVM.VaccineBatchID        = u.VaccineBatchID;
            rVM.SystemRecordVaccineID = u.SystemRecordVaccineID;
            rVM.RecordDataID          = u.RecordDataID;

            if (rVM.InoculationDate == null || DateTime.Equals(rVM.InoculationDate, new DateTime(2099, 1, 1, 1, 1, 1, 0)))
            {
                rVM.OrgID       = 0;
                rVM.CreatedDate = null;
            }

            //list.Add(VM);
            //find last InoculationDate
            var index = list.FindLastIndex(item => item.InoculationDateOut != null);
            if (index >= 0)
            {
                if (index + 1 <= list.Count)
                {
                    list.Insert(index + 1, rVM);
                }
                else
                {
                    list.Add(rVM);
                }
            }
            else
            {
                list.Insert(0, rVM);
            }
        }

        var LastInoculationDateIndex = list.FindLastIndex(item => item.InoculationDateOut != null);

        for (int i = LastInoculationDateIndex + 1; i <= list.Count - 1; i++)
        {
            list[i].DeltaDays = DeltaDays;
        }


        if (list.Count > 0)
        {
            tbAry = JsonConvert.SerializeObject(list);
        }
    }
Ejemplo n.º 27
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            ID = GetNumber <int>("i");

            if (this.IsPostBack == false)
            {
                DataTable dt = MSDB.GetDataTable("ConnUser", "dbo.usp_AccountM_xGetAccountCheckUserInfoByID"
                                                 , new Dictionary <string, object>()
                {
                    { "@UserID", ID }
                });
                VM = new UserVM();
                EntityS.FillModel(VM, dt);

                tbRID.Text           = VM.RocID.Trim();
                tbName.Text          = VM.UserName;
                tbPhone.Text         = VM.PhoneNumber;
                tbTitle.Text         = VM.Title;
                tbEmail.Text         = VM.Email;
                lblAccount.Text      = VM.LoginName;
                tbDept.Text          = VM.OrgNameByOrgID;
                rbList.SelectedValue = VM.CheckState.ToString();
                tbReason.Text        = VM.ApplyReason;
                tbDesp.Text          = VM.CheckDescription;
                //DisplayFileName = VM.DisplayFileName;
                DisplayFileNamesListJson = JsonConvert.SerializeObject(VM.DisplayFileNamesList);
                FileInfoIDsListJson      = JsonConvert.SerializeObject(VM.FileInfoIDsList);
                //FileInfoID = VM.FileInfoID;

                if (VM.IsBusiness == true)
                {
                    cbP.Checked = true;
                }

                dt = MSDB.GetDataTable("ConnUser", "dbo.usp_PowerM_xGetUserRoleByUserIDRoleCateID"
                                       , new Dictionary <string, object>()
                {
                    { "@UserID", ID },
                    { "@RoleCateID", Convert.ToInt32(WebConfigurationManager.AppSettings["RoleCateID"]) }
                });

                List <SystemRoleVM> vmList = new List <SystemRoleVM>();
                EntityS.FillModel(vmList, dt);
                List <int> userRoles = vmList.Select(item => item.ID).ToList();

                List <SystemRoleVM> outList = new List <SystemRoleVM>();

                foreach (var item in SystemRole.list)
                {
                    SystemRoleVM child = new SystemRoleVM();
                    child.ID       = item.ID;
                    child.RoleName = item.RoleName;
                    if (userRoles.Contains(item.ID))
                    {
                        child.IsUserRole = true;
                    }
                    outList.Add(child);
                }

                var orderOutList = outList.OrderBy((item) => item.RoleName);
                foreach (var item in orderOutList)
                {
                    ListItem li = new ListItem();
                    li.Text  = item.RoleName;
                    li.Value = item.ID.ToString();
                    if (item.IsUserRole == true)
                    {
                        li.Selected = true;
                    }
                    cbList.Items.Add(li);
                }
            }
            // Create the list to store.
            //List<String> YrStrList = new List<string>();
            //// Loop through each item.
            //foreach (ListItem item in cbList.Items)
            //{
            //    if (item.Selected)
            //    {
            //        // If the item is selected, add the value to the list.
            //        YrStrList.Add(item.Value);
            //    }
            //    else
            //    {
            //        // Item is not selected, do something else.
            //    }
            //}
            //// Join the string together using the ; delimiter.
            //String YrStr = String.Join(";", YrStrList.ToArray());

            //// Write to the page the value.
            //Response.Write(String.Concat("Selected Items: ", YrStr));
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 28
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);

        ViewPower   = base.GetPower(PowerList[0]);
        UpdatePower = base.GetPower(PowerList[1]);

        ElementarySchoolID = GetNumber <int>("i");

        if (ElementarySchoolID == 0)
        {
            IsValid = false;
            string script = "<style>body{display:none;}</style><script>alert('資料取得失敗');history.go(-1);</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        uc1.TableName = "O_OrgLog";
        uc1.WhereDict = new Dictionary <string, object>()
        {
            { "@OrgID", ID }
        };

        DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_CodeM_xGetElementarySchoolByID"
                                         , new Dictionary <string, object>()
        {
            { "@ElementarySchoolID", ElementarySchoolID }
        });
        SchoolCodeVM VM = new SchoolCodeVM();

        EntityS.FillModel(VM, dt);

        if (this.IsPostBack == false)
        {
            tbName.Text    = VM.SchoolName;
            tbCode.Text    = VM.SchoolCode;
            tbTel.Text     = VM.SchoolPhoneNumber;
            tbAddress.Text = VM.SchoolAddress;
        }

        County  = VM.SchoolCounty.ToString();
        Town    = VM.SchoolTown.ToString();
        Village = VM.SchoolVillage.ToString();

        CountyName  = SystemAreaCode.GetName(VM.SchoolCounty);
        TownName    = SystemAreaCode.GetName(VM.SchoolTown);
        VillageName = SystemAreaCode.GetName(VM.SchoolVillage);

        var codes = SystemCode.dict["CodeM_SchoolCode_EnableState"];

        ddlEnState.Attributes.Add("required", "required");
        var listItem = new ListItem("請選擇", "");

        ddlEnState.Items.Add(listItem);
        foreach (var item in codes)
        {
            ddlEnState.Items.Add(new ListItem(item.EnumName, item.EnumValue.ToString()));
        }

        try
        {
            ddlEnState.SelectedValue = VM.EnableState.ToString();
        }
        catch
        { }


        CountyJson  = JsonConvert.SerializeObject(SystemAreaCode.GetCountyList());
        TownJson    = JsonConvert.SerializeObject(SystemAreaCode.GetTownList(VM.SchoolCounty));
        VillageJson = JsonConvert.SerializeObject(SystemAreaCode.GetVillageList(VM.SchoolTown));
    }
Ejemplo n.º 29
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            CaseUserID              = GetNumber <int>("c");
            RecordDataID            = GetNumber <int>("i");
            SystemRecordVaccineCode = GetString("r");
            AppointmentDate         = GetString("a");
            AgeEnglish              = Server.UrlDecode(GetString("ae"));

            DateTime date    = default(DateTime);
            bool     success = DateTime.TryParse(AppointmentDate, out date);
            ShortTaiwanAppointmentDate = date.ToShortTaiwanDate();

            if (success == false || CaseUserID == 0 || RecordDataID == 0)
            {
                string script = "<script>alert('資料取得失敗');window.close();</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                return;
            }

            DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetSimpleCaseUserByID"
                                             , new Dictionary <string, object>()
            {
                { "@CaseUserID", CaseUserID }
            });

            EntityS.FillModel(VM, dt);

            dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetApplyRecordByRecordDataID"
                                   , new Dictionary <string, object>()
            {
                { "@RecordDataID", RecordDataID }
            });

            List <ApplyRecordVM> listR = new List <ApplyRecordVM>();
            EntityS.FillModel(listR, dt);
            ApplyRecordAry = JsonConvert.SerializeObject(listR);

            dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetApplyHealthByRecordDataID"
                                   , new Dictionary <string, object>()
            {
                { "@RecordDataID", RecordDataID }
            });
            List <ApplyHealthVM> listH = new List <ApplyHealthVM>();
            EntityS.FillModel(listH, dt);
            ApplyHealthAry = JsonConvert.SerializeObject(listH);



            dt = MSDB.GetDataTable("ConnDB", "dbo.usp_RecordM_xGetApplyEffectDetailByRecordDataID"
                                   , new Dictionary <string, object>()
            {
                { "@RecordDataID", RecordDataID }
            });

            List <ApplyEffectVM> listE = new List <ApplyEffectVM>();
            EntityS.FillModel(listE, dt);
            ApplyEffectAry = JsonConvert.SerializeObject(listE);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 30
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        if (Request.HttpMethod.Equals("POST"))
        {
            var user = AuthServer.GetLoginUser();

            int AgencyInfoID = GetNumber <int>("i");

            List <int> IDsList = GetList <int>("is");
            //string IDs = Request["is"] ?? "";

            //bool IsValid = false;
            //List<int> IDsList = new List<int>();
            //try
            //{
            //    IDsList = IDs.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)
            //                 .ToList<string>()
            //                 .ConvertAll<int>(item => int.Parse(item));

            //    IsValid = true;
            //}
            //catch
            //{
            //}

            if (AgencyInfoID == 0)//|| IsValid==false)
            {
                string script = "<script>alert('資料取得失敗');history.go(-1);</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                return;
            }

            DataTable dt = MSDB.GetDataTable("ConnDB", "dbo.usp_ParameterM_xGetVaccineByAgencyID"
                                             , new Dictionary <string, object>()
            {
                { "@AgencyInfoID", AgencyInfoID },
            });

            List <AddVaccineVM> list = new List <AddVaccineVM>();
            EntityS.FillModel(list, dt);

            if (IDsList.Count > 0)
            {
                foreach (var item in list)
                {
                    if (IDsList.Contains(item.ID))
                    {
                        item.IsChecked = true;
                    }
                }
            }

            ListJson = JsonConvert.SerializeObject(list);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }