Пример #1
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (IsValid == false)
        {
            return;
        }

        int State = 0;

        int.TryParse(ddlEnState.SelectedValue, out State);

        string Address = PureString(tbAddress.Text);
        string Tel     = PureString(tbTel.Text);

        int Address1 = GetNumber <int>("SelectCounty");
        int Address2 = GetNumber <int>("SelectTown");
        int Address3 = GetNumber <int>("SelectVillage");

        string Name = PureString(tbName.Text);
        string Code = PureString(tbCode.Text);

        var user = AuthServer.GetLoginUser();
        int Chk  = 0;

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

        MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_CodeM_xAddElementarySchool"
                             , ref OutDict
                             , new Dictionary <string, object>()
        {
            { "@SchoolName", Name },
            { "@EnableState", State },
            { "@SchoolCounty", Address1 },
            { "@SchoolTown", Address2 },
            { "@SchoolVillage", Address3 },
            { "@SchoolAddress", Address },
            { "@SchoolPhoneNumber", Tel },
            { "@SchoolCode", Code },
            { "@OrgID", user.OrgID }
        });

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

        string script = "";

        if (Chk > 0)
        {
            script = string.Format("{0}<script>alert('儲存成功');location.href='{1}#{2}';</script>",
                                   "<style>body{display:none;}</style>"
                                   , "/System/CodeM/SchoolCode.aspx"
                                   , HttpUtility.HtmlDecode(GetString("hash") ?? "")
                                   );

            SystemElementarySchool.Update();
        }
        else
        {
            switch (Chk)
            {
            case -1:
                script = "<script>alert('代碼重複');</script>";
                break;

            case -2:
                script = "<script>alert('同縣市學校名稱重複');</script>";
                break;

            default:
                script = "<script>alert('儲存失敗');</script>";
                break;
            }
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
Пример #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        //long Process_MemoryStart = 0;
        //long Process_MemoryEnd = 0;
        //System.Diagnostics.Process MyProcess = System.Diagnostics.Process.GetCurrentProcess();
        //Process_MemoryStart = MyProcess.PrivateMemorySize64;

        //Response.Write(Process_MemoryStart);
        //Console.WriteLine(Process_MemoryStart);

        //Console.WriteLine(GC.GetTotalMemory(true).ToString());

        SystemCode.Update();
        SystemRole.Update();
        SystemOrg.Update();
        SystemAreaCode.Update();
        SystemRecordVaccine.Update();
        SystemYCard.Update();
        SystemElementarySchool.Update();
        //Process_MemoryEnd = MyProcess.PrivateMemorySize64;
        //Response.Write(Process_MemoryEnd);
        //Console.WriteLine(Process_MemoryEnd);
        //HomeUrlVM vm =new HomeUrlVM();
        //vm.PageUrl = "/System/CodeM/CodeSetting.aspx";
        //vm.date = DateTime.Now;
        //string s = JsonConvert.SerializeObject(vm);
        //s=QueryStringEncryptToolS.Encrypt(s);
        //s = HttpUtility.UrlEncode(s);
        //Response.Write(s);
        //Response.End();

        //HomeUrlSecret secret = new HomeUrlSecret();
        //secret.RedirectUrl = "Home";

        //string s=JsonConvert.SerializeObject(secret);

        //UrlParameterEncryptT EncryptT = new UrlParameterEncryptT();
        //UrlParameterDecryptT DecryptT = new UrlParameterDecryptT();

        //s = EncryptT.GetOutSecretJsonWithEncrypt(secret);
        //string ss = s;
        //int cc = s.Length;
        //Response.Write(s);
        //Response.Write("<br/>");
        //Response.Write(s.Length);
        //s = HttpUtility.UrlEncode(s);
        //Response.Write("<br/>");
        //Response.Write(s);
        //Response.Write("<br/>");
        //Response.Write(s.Length);
        //Response.Write("<br/>");
        //string a = Request["o"]??"";
        //int b = 0;
        //int.TryParse(Request["c"] ?? "0", out b);
        //HomeUrlSecret secret2 = new HomeUrlSecret();
        //secret2 = DecryptT.GetUrlSecret<HomeUrlSecret>(ss, TimeSpan.FromDays(1), cc);
        //if(secret2.IsValid==true)
        //    Response.Write("2Checksum驗證成功");
        //else
        //    Response.Write("2Checksum驗證失敗");
        //Response.End();
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        int AdmissionYear = 0;

        int.TryParse(PureString(ddlYear.SelectedValue), out AdmissionYear);
        int SchoolID    = GetNumber <int>("ss");
        int StudentYear = ddlST.SelectedIndex + 1;

        int SignUserID = user.ID;
        int OrgID      = user.OrgID;

        string VaccineTypeString             = GetString("v");
        string InoculationNumberString       = GetString("i");
        string ShouldInoculationNumberString = GetString("ss");

        bool IsValid = false;

        try
        {
            List <int> list = VaccineTypeString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                              .ToList <string>()
                              .ConvertAll <int>(item => int.Parse(item));

            list = InoculationNumberString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                   .ToList <string>()
                   .ConvertAll <int>(item => int.Parse(item));

            list = ShouldInoculationNumberString.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)
                   .ToList <string>()
                   .ConvertAll <int>(item => int.Parse(item));

            IsValid = true;
        }
        catch
        {
        }

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

        string script = "";

        int Chk = 0;


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

        MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_RecordM_xAddElementaryRecord"
                             , ref OutDict
                             , new Dictionary <string, object>()
        {
            { "@ElementarySchoolID", SchoolID },
            { "@AdmissionYear", AdmissionYear },
            { "@StudentNumber", 0 },
            { "@HasYellowCardNumber", 0 },
            { "@SignUserID", user.ID },
            { "@CreatedUserID", user.ID },
            { "@StudentYear", StudentYear },
            { "@InoculationType", 2 },
            { "@VaccineTypeString", string.Join(",", VaccineTypeString) },
            { "@InoculationNumberString", string.Join(",", InoculationNumberString) },
            { "@ShouldInoculationNumberString", string.Join(",", ShouldInoculationNumberString) },
            { "@OrgID", OrgID }
        });

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

        if (Chk > 0)
        {
            script = "<style>body{display:none;}</style><script>alert('儲存成功');location.href = '/Vaccination/RecordM/StudentReRecord.aspx';</script>";
            SystemElementarySchool.Update();
        }
        else
        {
            switch (Chk)
            {
            case -1:
                script = "<script>alert('一個學校一個年度一級別僅有一份數據');</script>";
                break;

            default:
                script = "<script>alert('儲存失敗');</script>";
                break;
            }
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }