예제 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(false);
        base.BodyClass = "class='bodybg'";

        var user = AuthServer.GetLoginUser();


        int    CaseUserID = 0;
        string SystemRecordVaccineCode      = "";
        int    RecordDataID                 = 0;
        bool   HasInsertSystemRecordVaccine = false;
        int    Chk = 0;

        int.TryParse(Request.Form["c"], out CaseUserID);
        SystemRecordVaccineCode = Request.Form["r"] ?? "";

        if (CaseUserID > 0 || SystemRecordVaccineCode.Equals("") == false)
        {
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_RecordM_xAddRecordData", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@CaseUserID", CaseUserID);
                    cmd.Parameters.AddWithValue("@SystemRecordVaccineCode", SystemRecordVaccineCode);
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    cmd.Parameters.AddWithValue("@CreatedUserID", user.ID);
                    SqlParameter sp1 = cmd.Parameters.AddWithValue("@RecordDataID", RecordDataID);
                    sp1.Direction = ParameterDirection.Output;
                    SqlParameter sp2 = cmd.Parameters.AddWithValue("@HasInsertSystemRecordVaccine", HasInsertSystemRecordVaccine);
                    sp2.Direction = ParameterDirection.Output;
                    SqlParameter sp3 = cmd.Parameters.AddWithValue("@Chk", Chk);
                    sp3.Direction = ParameterDirection.Output;

                    sc.Open();
                    cmd.ExecuteNonQuery();

                    RecordDataID = (int)sp1.Value;
                    HasInsertSystemRecordVaccine = (bool)sp2.Value;
                    Chk = (int)sp3.Value;
                }

                if (HasInsertSystemRecordVaccine == true)
                {
                    SystemRecordVaccine.Update();
                }
                OPVM VM = new OPVM();
                VM.message = RecordDataID.ToString();
                VM.chk     = Chk;

                Response.ContentType = "application/json; charset=utf-8";
                Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(VM));
                Response.End();
            }
        }
    }
예제 #2
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(false);

        var user = AuthServer.GetLoginUser();


        int    CaseUserID = 0;
        string SystemRecordVaccineCode      = "";
        int    SystemRecordVaccineID        = 0;
        int    RecordDataID                 = 0;
        bool   HasInsertSystemRecordVaccine = false;
        int    Chk = 0;

        CaseUserID = GetNumber <int>("c");
        SystemRecordVaccineCode = GetString("r");

        if (CaseUserID > 0 || SystemRecordVaccineCode.Length > 0)
        {
            Dictionary <string, object> OutDict = new Dictionary <string, object>()
            {
                { "@RecordDataID", RecordDataID },
                { "@HasInsertSystemRecordVaccine", HasInsertSystemRecordVaccine },
                { "@SystemRecordVaccineID", SystemRecordVaccineID },
                { "@Chk", Chk }
            };

            MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_RecordM_xAddRecordData"
                                 , ref OutDict
                                 , new Dictionary <string, object>()
            {
                { "@CaseUserID", CaseUserID },
                { "@SystemRecordVaccineCode", SystemRecordVaccineCode },
                { "@OrgID", user.OrgID },
                { "@CreatedUserID", user.ID }
            });

            RecordDataID = (int)OutDict["@RecordDataID"];
            HasInsertSystemRecordVaccine = (bool)OutDict["@HasInsertSystemRecordVaccine"];
            Chk = (int)OutDict["@Chk"];

            if (HasInsertSystemRecordVaccine == true)
            {
                SystemRecordVaccine.Update();
            }
            OPVM VM = new OPVM();
            VM.message = RecordDataID.ToString();
            VM.chk     = Chk;

            Response.ContentType = "application/json; charset=utf-8";
            Response.Write(JsonConvert.SerializeObject(VM));
            Response.End();
        }
    }
예제 #3
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();
    }
예제 #4
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");
            DateTime date    = default(DateTime);
            bool     success = DateTime.TryParse(AppointmentDate, out date);
            //AppointmentDate = date.ToShortTaiwanDate();

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



            bool HasInsertSystemRecordVaccine = false;
            int  Chk = 0;


            if (CaseUserID > 0 && SystemRecordVaccineCode.Length > 0 && RecordDataID == 0)
            {
                var user = AuthServer.GetLoginUser();

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

                MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_RecordM_xAddRecordData"
                                     , ref OutDict
                                     , new Dictionary <string, object>()
                {
                    { "@CaseUserID", CaseUserID },
                    { "@SystemRecordVaccineCode", SystemRecordVaccineCode },
                    { "@OrgID", user.OrgID },
                    { "@CreatedUserID", user.ID }
                });

                RecordDataID                 = (int)OutDict["@RecordDataID"];
                SystemRecordVaccineID        = (int)OutDict["@SystemRecordVaccineID"];
                HasInsertSystemRecordVaccine = (bool)OutDict["@HasInsertSystemRecordVaccine"];
                Chk = (int)OutDict["@Chk"];

                if (HasInsertSystemRecordVaccine == true)
                {
                    SystemRecordVaccine.Update();
                }

                if (Chk < 1 || RecordDataID == 0)
                {
                    lblScript.Text = "<script>alert('資料取得失敗');window.close();</script>";
                }
                else
                {
                    Dictionary <string, object> dict = new Dictionary <string, object>();
                    dict.Add("SCode", SystemRecordVaccineCode);
                    dict.Add("RID", RecordDataID);
                    lblScript.Text = "<script>window.opener.getRecordDataID(" + JsonConvert.SerializeObject(dict) + ");document.getElementById('formid').submit();</script>";
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
예제 #5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);
        base.BodyClass = "class='bodybg'";

        if (Request.HttpMethod.Equals("POST"))
        {
            int.TryParse(Request.Form["c"], out CaseUserID);
            int.TryParse(Request.Form["i"], out RecordDataID);
            SystemRecordVaccineCode = Request.Form["r"] ?? "";
            AppointmentDate         = Request.Form["a"] ?? "";
            DateTime date    = default(DateTime);
            bool     success = DateTime.TryParse(AppointmentDate, out date);
            //AppointmentDate = date.ToShortTaiwanDate();

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



            bool HasInsertSystemRecordVaccine = false;
            int  Chk = 0;


            if (CaseUserID > 0 && SystemRecordVaccineCode.Equals("") == false && RecordDataID == 0)
            {
                var user = AuthServer.GetLoginUser();
                using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
                {
                    using (SqlCommand cmd = new SqlCommand("dbo.usp_RecordM_xAddRecordData", sc))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@CaseUserID", CaseUserID);
                        cmd.Parameters.AddWithValue("@SystemRecordVaccineCode", SystemRecordVaccineCode);
                        cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                        cmd.Parameters.AddWithValue("@CreatedUserID", user.ID);
                        SqlParameter sp1 = cmd.Parameters.AddWithValue("@RecordDataID", RecordDataID);
                        sp1.Direction = ParameterDirection.Output;
                        SqlParameter sp2 = cmd.Parameters.AddWithValue("@HasInsertSystemRecordVaccine", HasInsertSystemRecordVaccine);
                        sp2.Direction = ParameterDirection.Output;
                        SqlParameter sp3 = cmd.Parameters.AddWithValue("@Chk", Chk);
                        sp3.Direction = ParameterDirection.Output;

                        sc.Open();
                        cmd.ExecuteNonQuery();

                        RecordDataID = (int)sp1.Value;
                        HasInsertSystemRecordVaccine = (bool)sp2.Value;
                        Chk = (int)sp3.Value;
                    }

                    if (HasInsertSystemRecordVaccine == true)
                    {
                        SystemRecordVaccine.Update();
                    }



                    if (Chk < 1 || RecordDataID == 0)
                    {
                        lblScript.Text = "<script>alert('資料取得失敗');window.close();</script>";
                    }
                    else
                    {
                        Dictionary <string, object> dict = new Dictionary <string, object>();
                        dict.Add("SCode", SystemRecordVaccineCode);
                        dict.Add("RID", RecordDataID);
                        lblScript.Text = "<script>window.opener.getRecordDataID(" + JsonConvert.SerializeObject(dict) + ");document.getElementById('formid').submit();</script>";
                    }
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }