Ejemplo n.º 1
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);
            VaccineCode     = 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 || RecordDataID == 0)
            {
                string script = "<script>alert('資料取得失敗');window.close();</script>";
                Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                return;
            }


            string SystemRecordVaccineCode = "";
            SystemRecordVaccineCode = Request.Form["r"] ?? "";

            bool HasInsertSystemRecordVaccine = false;
            int  Chk = 0;


            if (CaseUserID > 0 || SystemRecordVaccineCode.Equals("") == false)
            {
                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)
                    {
                        string script = "<script>alert('資料取得失敗');window.close();</script>";
                        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
                        return;
                    }
                }
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string script  = "";
        string message = CheckNeeded();

        if (message.Length > 0)
        {
            script = "<script>alert('" + message + "');</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }



        string title       = tbTitle.Text.Trim();
        string description = tbDesp.Text.Trim();

        int         state  = 0;
        RadioButton thisRb = null;

        thisRb = form1.Controls.OfType <RadioButton>().FirstOrDefault(rb => rb.Checked);
        if (thisRb != null)
        {
            switch (thisRb.ID)
            {
            case "rb1":
                state = 1;
                break;

            case "rb2":
                state = 2;
                break;
            }
        }


        UserVM user              = AuthServer.GetLoginUser();
        int    OutFileInfoID     = 0;
        bool   UploadFileSuccess = true;
        int    Chk = 0;


        List <int> OutFileInfoID_List = new List <int>();

        if (tbFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                //string fileName = Path.GetFileName(uploadedFile.FileName);
                //if (uploadedFile.ContentLength > 0)
                //{
                //    uploadedFile.SaveAs(Server.MapPath("~/Files/") + fileName);
                //    Label1.Text += fileName + "Saved <BR>";
                //}

                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                string         extension    = "";
                //string[] ary = tbFile.FileName.Split('.');
                string[] ary = uploadedFile.FileName.Split('.');
                if (ary.Length > 1)
                {
                    extension = ary.Last();
                }

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }

                NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
                string contentType = tbFile.PostedFile.ContentType;
                OutFileInfoID = WS.UploadFile(1, contentType, extension, uploadedFile.FileName, user.ID, user.OrgID, fileData);

                if (OutFileInfoID < 1)
                {
                    UploadFileSuccess = false;
                    break;
                }
                else
                {
                    OutFileInfoID_List.Add(OutFileInfoID);
                }
            }
        }

        string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());


        if (UploadFileSuccess == true)
        {
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_DocumentM_xAddDocumentInfo", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@DocTitle", title);
                    cmd.Parameters.AddWithValue("@PublishState", state);
                    cmd.Parameters.AddWithValue("@DocDescription", description);
                    cmd.Parameters.AddWithValue("@CreatedUserID", user.ID);
                    //cmd.Parameters.AddWithValue("@FileInfoID", OutFileInfoID);
                    cmd.Parameters.AddWithValue("@FileInfoIDs", OutFileInfoIDs);

                    SqlParameter sp = cmd.Parameters.AddWithValue("@Chk", Chk);
                    sp.Direction = ParameterDirection.Output;

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

                    Chk = (int)sp.Value;
                }
            }
        }

        if (UploadFileSuccess && Chk > 0)
        {
            script = "<script>alert('儲存成功');location.href = '/System/DocumentM/DocumentMaintain.aspx';</script><style>body{display:none;}</style>";
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }



        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
Ejemplo n.º 3
0
    protected void Save_Click(object sender, EventArgs e)
    {
        UserVM user    = AuthServer.GetLoginUser();
        string script  = "";
        string message = CheckNeeded();

        if (message.Length > 0)
        {
            script = "<script>alert('" + message + "');</script>";
            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", script, false);
            return;
        }

        int  OutFileInfoID     = 0;
        bool UploadFileSuccess = true;

        List <int> OutFileInfoID_List = new List <int>();

        if (TempFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                string         extension    = "";
                string[]       ary          = uploadedFile.FileName.Split('.');
                if (ary.Length > 1)
                {
                    extension = ary.Last();
                }

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }

                NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
                string contentType = TempFile.PostedFile.ContentType;
                OutFileInfoID = WS.UploadFile(5, contentType, extension, uploadedFile.FileName, user.ID, user.OrgID, fileData);

                if (OutFileInfoID < 1)
                {
                    UploadFileSuccess = false;
                    break;
                }
                else
                {
                    OutFileInfoID_List.Add(OutFileInfoID);
                }
            }
        }

        string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());

        string dealDate       = (Convert.ToInt32(DealDate.Text.Substring(0, 3)) + 1911).ToString() + "/" + DealDate.Text.Substring(3, 2) + "/" + DealDate.Text.Substring(5, 2);
        int    dealType       = int.Parse(DealType.SelectedValue);
        int    dealHospitalID = 0;

        if (dealType == 4)
        {
            int.TryParse(DealHospitalID.Value, out dealHospitalID);
        }
        string remark       = Remark.Text.Trim();
        string num          = Num.Text.Trim();
        string tempHigh     = TempHigh.Text.Trim();
        int    froIdx       = int.Parse(FroIdx.SelectedValue);
        string tempLow      = TempLow.Text.Trim();
        int    oriFroIdx    = int.Parse(OriFroIdx.SelectedValue);
        int    monIdx       = int.Parse(MonIdx.SelectedValue);
        int    CheckStorage = 0;
        int    Success      = 0;

        int VaccInBatchDataID;

        HttpUtility.HtmlEncode(int.TryParse(Request.QueryString["BI"], out VaccInBatchDataID));

        if (UploadFileSuccess == true)
        {
            DataSet ds = new DataSet();
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("usp_VaccineIn_xUpdateSearchVaccineInBatchData", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", VaccInBatchDataID);
                    cmd.Parameters.AddWithValue("@Num", num);
                    cmd.Parameters.AddWithValue("@TempHigh", tempHigh);
                    cmd.Parameters.AddWithValue("@FroIdx", froIdx);
                    cmd.Parameters.AddWithValue("@TempLow", tempLow);
                    cmd.Parameters.AddWithValue("@OriFroIdx", oriFroIdx);
                    cmd.Parameters.AddWithValue("@MonIdx", monIdx);
                    cmd.Parameters.AddWithValue("@TempFile", OutFileInfoIDs);
                    cmd.Parameters.AddWithValue("@DealDate", dealDate);
                    cmd.Parameters.AddWithValue("@DealType", dealType);
                    cmd.Parameters.AddWithValue("@DealHospitalID", dealHospitalID);
                    cmd.Parameters.AddWithValue("@Remark", remark);
                    cmd.Parameters.AddWithValue("@ModifyAccount", user.ID);
                    SqlParameter sp  = cmd.Parameters.AddWithValue("@CheckStorage", CheckStorage);
                    SqlParameter sp1 = cmd.Parameters.AddWithValue("@Success", Success);
                    sp.Direction  = ParameterDirection.Output;
                    sp1.Direction = ParameterDirection.Output;
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(ds);
                        CheckStorage = (int)sp.Value;
                        Success      = (int)sp1.Value;
                    }
                }
            }
        }

        if (UploadFileSuccess && Success > 0)
        {
            script = "<script>alert('儲存成功!');location.href = '/Vaccine/StockManagementM/VaccineIn/Search_VaccineIn.aspx';</script>";
        }
        else
        {
            if (CheckStorage > 0)
            {
                script = "<script>alert('庫存量不足!');</script>";
            }
            else
            {
                script = "<script>alert('儲存失敗!');</script>";
            }
        }

        Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", script, false);
    }
Ejemplo n.º 4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (IsValid == false)
        {
            return;
        }
        string script = "";

        string CaseUserChName   = PureString(tbName.Text);
        string CaseUserEnName   = PureString(tbE.Text);
        string ApplyUserName    = PureString(tbA.Text);
        string UserRelationship = PureString(tbR.Text);
        var    user             = AuthServer.GetLoginUser();

        int           OutFileInfoID      = 0;
        bool          UploadFileSuccess  = true;
        List <int>    OutFileInfoID_List = new List <int>();
        StringBuilder errorSb            = new StringBuilder();
        string        errMsg             = "";

        if (tbFile.HasFile == true)
        {
            List <string> list = new List <string>()
            {
                //"application/pdf",
                "application/msword",
                "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                "application/vnd.ms-excel",
                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            };

            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                string         extension    = "";
                string[]       ary          = uploadedFile.FileName.Split('.');
                if (ary.Length > 1)
                {
                    extension = ary.Last();
                }

                if (list.Contains(uploadedFile.ContentType) == false)
                {
                    errorSb.Append("alert('上傳格式限WORD、EXCEL');");
                }

                if (uploadedFile.ContentLength > 3 * 1024 * 1024)
                {
                    errorSb.Append("alert('大小限3M以內');");
                }
                errMsg = errorSb.ToString();
                if (errMsg.Length > 0)
                {
                    break;
                }

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }

                NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
                string contentType = tbFile.PostedFile.ContentType;
                OutFileInfoID = WS.UploadFile(1, contentType, extension, uploadedFile.FileName, user.ID, user.OrgID, fileData);

                if (OutFileInfoID < 1)
                {
                    UploadFileSuccess = false;
                    break;
                }
                else
                {
                    OutFileInfoID_List.Add(OutFileInfoID);
                }
            }
        }

        if (errMsg.Length > 0)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", "<script>" + errMsg + "</script>", false);
            return;
        }

        string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());

        int         ApplyFormat = 0;
        RadioButton selected    = MyForm.Controls.OfType <RadioButton>().FirstOrDefault(rb => rb.Checked);

        if (selected != null)
        {
            switch (selected.ID)
            {
            case "rb1":
                ApplyFormat = 1;
                break;

            case "rb2":
                ApplyFormat = 2;
                break;
            }
        }

        int Chk = 0;

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

            MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_CertificateM_xAddApplyData"
                                 , ref OutDict
                                 , new Dictionary <string, object>()
            {
                { "@CaseUserID", CaseUserID },
                { "@CaseUserChName", CaseUserChName },
                { "@CaseUserEnName", CaseUserEnName },
                { "@ApplyUserName", ApplyUserName },
                { "@UserRelationship", UserRelationship },
                { "@CreatedUserID", user.ID },
                { "@OrgID", user.OrgID },
                { "@FileInfoIDs", OutFileInfoIDs },
                { "@ApplyFormat", ApplyFormat },
            });

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

        if (UploadFileSuccess && Chk > 0)
        {
            script = "<style>body{display:none;}</style><script>alert('儲存成功');window.close();</script>";
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
Ejemplo n.º 5
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);
        base.BodyClass = "class='bodybg'";

        int.TryParse(Request.Form["au"], out AssessmentUserID);
        //DateTime.TryParse(Request.Form["AD"], out AssessmentDate);
        DateTime.TryParseExact((Request.Form["ad"] ?? DateTime.Now.ToShortTaiwanDate()).RepublicToAD(),
                               "yyyyMMdd",
                               CultureInfo.InvariantCulture,
                               DateTimeStyles.None,
                               out AssessmentDate);
        bool.TryParse(Request.Form["AW"], out AllowWork);
        ApplyHealthCateIDs = Request.Form["AH"] ?? "";
        bool IsValid = false;

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

            IsValid = true;
        }
        catch
        {
        }


        OtherState = Request.Form["os"] ?? "";
        int.TryParse(Request.Form["rd"], out RecordDataID);

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

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

        using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
        {
            using (SqlCommand cmd = new SqlCommand("dbo.usp_RecordM_xAddOrUpdateApplyHealth", sc))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@ApplyHealthID", 0);
                cmd.Parameters.AddWithValue("@AssessmentUserID", AssessmentUserID);
                cmd.Parameters.AddWithValue("@AssessmentDate", AssessmentDate);
                cmd.Parameters.AddWithValue("@CreatedUserID", user.ID);
                cmd.Parameters.AddWithValue("@AllowWork", AllowWork);
                cmd.Parameters.AddWithValue("@ApplyHealthCateIDs", ApplyHealthCateIDs);
                cmd.Parameters.AddWithValue("@OtherState", OtherState);
                cmd.Parameters.AddWithValue("@RecordDataID", RecordDataID);
                cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                SqlParameter sp = cmd.Parameters.AddWithValue("@Chk", Chk);
                sp.Direction = ParameterDirection.Output;

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

                Chk = (int)sp.Value;
            }
        }

        OPVM VM = new OPVM();

        VM.chk = Chk;
        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(VM));
        Response.End();
    }
Ejemplo n.º 6
0
  protected void btnSave_Click(object sender, EventArgs e)
  {
      List <string> RequestKeys = Request.Form.AllKeys.Where(key => key.Contains("ddlVaccineCode_") || key.Contains("ddlNotNeedOrRejectReason_") || key.Contains("tbPrDate_")).ToList();

      UserVM user   = AuthServer.GetLoginUser();
      string VacIDs = hdVac.Value ?? "";

      string[] Vac         = VacIDs.Split(',');
      string   VisitResult = ddlVisitResult.SelectedValue;
      string   spName      = (VisitID != 0 ? "usp_CaseVisit_xEdit" : "usp_CaseVisit_xAdd");

      DataTable dt = (DataTable)DBUtil.DBOp("ConnDB",
                                            "exec  [dbo].[" + spName + "]  {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10}   "
                                            , new string[] {
            TaiwanYear.ToDateString(tbVisitDate.Text)
            , (VisitID != 0 ? VisitID.ToString() : CaseID.ToString())
            , ddlVisitMan.SelectedValue
            , ddlVisitType.SelectedValue
            , ddlVisitReason.SelectedValue
            , VisitResult
            , tbVisitComment.Text
            , user.ID.ToString()
            , user.OrgID.ToString()
            , TaiwanYear.ToDateString(tbPreBackDate.Text)
            , ddlCountry.SelectedValue
        }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable);



      int NewVisitID = 0;

      if (dt.Rows.Count > 0)
      {
          NewVisitID = Convert.ToInt32(dt.Rows[0][0]);
          CaseID     = Convert.ToInt32(dt.Rows[0][1]);
          handlefile(NewVisitID);
      }


      DBUtil.DBOp("ConnDB", "  UPDATE [dbo].[C_CaseVisitDetail] SET  [LogicDel] = 1 where VisitID={0} "
                  , new string[] { NewVisitID.ToString() }, NSDBUtil.CmdOpType.ExecuteNonQuery);

      //Response.Write(VacIDs);
      //Response.End();
      foreach (string v in Vac)
      {
          string VacIDSeq = "", VisitResultDetailID = "0", PrejectDate = "", VacID = "", Seq = "";

          VacIDSeq            = Request.Form [RequestKeys.Find(r => r.Contains("ddlVaccineCode_" + v))] ?? "";
          VacID               = (VacIDSeq == "" ?v: VacIDSeq.Split('-')[0]);
          Seq                 = (VacIDSeq.Split('-').Length > 1 ? VacIDSeq.Split('-')[1] :"");
          VisitResultDetailID = Request.Form [RequestKeys.Find(r => r.Contains("ddlNotNeedOrRejectReason_" + v))] ?? "";
          PrejectDate         = TaiwanYear.ToDateString(Request.Form[RequestKeys.Find(r => r.Contains("tbPrDate_" + v))] ?? "");

          DBUtil.DBOp("ConnDB", " exec [dbo].[usp_CaseVisit_xAddDetail]   {0},{1},{2} ,{3},{4}   "
                      , new string[] { NewVisitID.ToString(), VacID, Seq, VisitResultDetailID, PrejectDate }, NSDBUtil.CmdOpType.ExecuteNonQuery);
      }

      //更新個人紀錄
      DBUtil.DBOp("ConnDB", " exec [dbo].[usp_CaseVisit_xUpdateRecordData]  {0} "
                  , new string[] { NewVisitID.ToString() }, NSDBUtil.CmdOpType.ExecuteNonQuery);



      Page.ClientScript.RegisterStartupScript(Page.GetType(), "", "alert('成功!');location.href='VisitCaseList.aspx?i=" + CaseID.ToString() + "';", true);
  }
Ejemplo n.º 7
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);
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        UserVM user = AuthServer.GetLoginUser();

        int PID      = SystemOrg.GetVM(user.OrgID).PID;
        int OrgLevel = SystemOrg.GetVM(user.OrgID).OrgLevel;

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

        list.AddRange(SystemOrg.list);

        if (Convert.ToInt32(WebConfigurationManager.AppSettings["OrgAreaSet"]) == 0)
        {
            if (OrgLevel == 1)
            {
                //移除:與登入者平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 2));
            }
            else if (OrgLevel == 3)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 2 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 2 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
            else if (OrgLevel == 4)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 1 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 1 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
            else if (OrgLevel == 5)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 1 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 1 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
        }
        else if (Convert.ToInt32(WebConfigurationManager.AppSettings["OrgAreaSet"]) == 1)
        {
            if (OrgLevel == 1)
            {
                //移除:與登入者平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
            }
            else if (OrgLevel == 2)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 1 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 1 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
            else if (OrgLevel == 3)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 1 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 1 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
            else if (OrgLevel == 4)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 1 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 1 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
            else if (OrgLevel == 5)
            {
                //移除:與登入者上一層、平層、下一層以外的單位
                list.RemoveAll(item => !(item.OrgLevel == OrgLevel - 1 || item.OrgLevel == OrgLevel || item.OrgLevel == OrgLevel + 1));
                //移除:與登入者上一層同,卻不是登入者的上層
                list.RemoveAll(item => item.OrgLevel == OrgLevel - 1 && item.ID != PID);
                //移除:與登入者同一層,且直屬單位不同
                list.RemoveAll(item => item.OrgLevel == OrgLevel && item.PID != PID);
                //移除:與登入者下一層,且不屬於登入者下層單位
                list.RemoveAll(item => item.OrgLevel == OrgLevel + 1 && item.PID != user.OrgID);
            }
        }

        MyTreeData = JsonConvert.SerializeObject(list.Where(item => item.OrgCateID == Convert.ToInt32(WebConfigurationManager.AppSettings["OrgCateID"])));
    }
Ejemplo n.º 9
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        //base.AllowHttpMethod("POST");
        //base.DisableTop(true);
        int    pgNow = 1, pgSize = 10;
        int    OrderCol = 0, OrderAsc = 1;//0出生日期1身份證號    //1ASC 0 DESC
        int    OrgID = 0;
        int    AddrKind = 0, CountyID = 0, TownID = 0;
        int    SearchNumberType = 0;
        string BirthDateS = "", BirthDateE = "";
        string CaseName = "", CaseIdNo = "", HouseNo = "";
        string ContactName = "", ContactIdNo = "", ContactBirthDate = "";

        #region QS()
        BirthDateS       = Request.Form["BirthDateS"] ?? "";
        BirthDateE       = Request.Form["BirthDateE"] ?? "";
        ContactBirthDate = Request.Form["ContactBirthDate"] ?? "";
        if (BirthDateS != "")
        {
            BirthDateS = (Convert.ToInt32(BirthDateS.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateS.Substring(3, 2) + "/" + BirthDateS.Substring(5, 2);
        }
        if (BirthDateE != "")
        {
            BirthDateE = (Convert.ToInt32(BirthDateE.Substring(0, 3)) + 1911).ToString() + "/" + BirthDateE.Substring(3, 2) + "/" + BirthDateE.Substring(5, 2);
        }
        if (ContactBirthDate != "")
        {
            ContactBirthDate = (Convert.ToInt32(ContactBirthDate.Substring(0, 3)) + 1911).ToString() + "/" + ContactBirthDate.Substring(3, 2) + "/" + ContactBirthDate.Substring(5, 2);
        }

        CaseName    = Request.Form["CaseName"] ?? "";
        CaseIdNo    = Request.Form["CaseIdNo"] ?? "";
        HouseNo     = Request.Form["HouseNo"] ?? "";
        ContactName = Request.Form["ContactName"] ?? "";
        ContactIdNo = Request.Form["ContactIdNo"] ?? "";

        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["pgSize"], out pgSize);
        int.TryParse(Request.Form["AddrKind"], out AddrKind);
        int.TryParse(Request.Form["OrgID"], out OrgID);
        int.TryParse(Request.Form["CountyID"], out CountyID);
        int.TryParse(Request.Form["TownID"], out TownID);
        int.TryParse(Request.Form["NumberType"], out SearchNumberType);

        int.TryParse(Request.Form["OrderCol"], out OrderCol);
        int.TryParse(Request.Form["OrderAsc"], out OrderAsc);


        #endregion

        OrgID = AuthServer.GetLoginUser().OrgID;


        DataTableCollection dtc = (DataTableCollection)DBUtil.DBOp("ConnDB"
                                                                   , "exec dbo.usp_CaseUser_xGetUserList {0},{1},{2},{3},{4},{5},{6},{7},{8},{9},{10},{11},{12},{13},{14},{15},{16}"
                                                                   , new string[] { pgNow.ToString()
                                                                                    , pgSize.ToString()
                                                                                    , OrderCol.ToString()
                                                                                    , OrderAsc.ToString()
                                                                                    , CaseName
                                                                                    , CaseIdNo
                                                                                    , BirthDateS
                                                                                    , BirthDateE
                                                                                    , HouseNo
                                                                                    , AddrKind.ToString()
                                                                                    , ContactName
                                                                                    , ContactIdNo
                                                                                    , ContactBirthDate
                                                                                    , OrgID.ToString() //請帶入想查看的ORG   //若沒得選 請帶入目前登入user.org
                                                                                    , CountyID.ToString()
                                                                                    , TownID.ToString()
                                                                                    , SearchNumberType.ToString() }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTableCollection);



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

        EntityS.FillModel(list, dtc[0]);
        EntityS.FillModel(rtn, dtc[1]);
        rtn.message = list;

        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }
Ejemplo n.º 10
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"))
        {
            nowDate = DateTime.Now.ToShortTaiwanDate();
            int.TryParse(Request.Form["c"], out CaseUserID);
            int.TryParse(Request.Form["i"], out RecordDataID);
            VaccineCode     = 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 || 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));
            }

            var user = AuthServer.GetLoginUser();
            UserName = user.UserName;

            DataTable dt = new DataTable();
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnUser"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_AccountM_xGetUserListByOrgID", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(dt);
                    }
                }
            }

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

            EntityS.FillModel(list, dt);

            UserAry = Newtonsoft.Json.JsonConvert.SerializeObject(list);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 11
0
    protected void Page_Load(object sender, EventArgs e)
    {
        SearchPower = base.AddPower(SearchPower);
        UserVM user = AuthServer.GetLoginUser();

        int    pgNow;
        int    pgSize;
        string StartDeal  = "";
        string EndDeal    = "";
        int    InOrgType  = 0;
        string InOrgID    = "";
        int    Staff      = 0;
        int    VaccineID  = 0;
        int    BatchType  = 0;
        int    BatchID    = 0;
        int    DealStatus = 0;
        int    Sort       = 0;

        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["pgSize"], out pgSize);
        if (SearchPower.HasPower == true)
        {
            StartDeal = Request.Form["StartDeal"];
            EndDeal   = Request.Form["EndDeal"];
            int.TryParse(Request.Form["InOrgType"], out InOrgType);
            InOrgID = Request.Form["InOrgID"];
            int.TryParse(Request.Form["Staff"], out Staff);
            int.TryParse(Request.Form["VaccineID"], out VaccineID);
            int.TryParse(Request.Form["BatchType"], out BatchType);
            int.TryParse(Request.Form["BatchID"], out BatchID);
            int.TryParse(Request.Form["DealStatus"], out DealStatus);
            int.TryParse(Request.Form["Sort"], out Sort);

            if (StartDeal == "NaN")
            {
                StartDeal = "";
            }
            if (EndDeal == "NaN")
            {
                EndDeal = "";
            }
            if (InOrgID == "")
            {
                InOrgType = 0;
            }
        }
        DataSet ds = new DataSet();

        using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
        {
            using (SqlCommand cmd = new SqlCommand("usp_VaccineOut_xSearchTable", sc))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@pgNow", pgNow);
                cmd.Parameters.AddWithValue("@pgSize", pgSize);
                cmd.Parameters.AddWithValue("@StartDeal", StartDeal);
                cmd.Parameters.AddWithValue("@EndDeal", EndDeal);
                cmd.Parameters.AddWithValue("@OutOrgType", 2);
                cmd.Parameters.AddWithValue("@OutOrgID", user.OrgID);
                cmd.Parameters.AddWithValue("@InOrgType", InOrgType);
                cmd.Parameters.AddWithValue("@InOrgID", InOrgID);
                cmd.Parameters.AddWithValue("@Staff", Staff);
                cmd.Parameters.AddWithValue("@VaccineID", VaccineID);
                cmd.Parameters.AddWithValue("@BatchType", BatchType);
                cmd.Parameters.AddWithValue("@BatchID", BatchID);
                cmd.Parameters.AddWithValue("@DealStatus", DealStatus);
                cmd.Parameters.AddWithValue("@Sort", Sort);
                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    sc.Open();
                    da.Fill(ds);
                }
            }
        }

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

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

        rtn.message          = list;
        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(Newtonsoft.Json.JsonConvert.SerializeObject(rtn));
        Response.End();
    }
Ejemplo n.º 12
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string script = "";


        string CaseUserChName   = tbName.Text.Trim();
        string CaseUserEnName   = tbE.Text.Trim();
        string ApplyUserName    = tbA.Text.Trim();
        string UserRelationship = tbR.Text.Trim();
        var    user             = AuthServer.GetLoginUser();



        int        OutFileInfoID      = 0;
        bool       UploadFileSuccess  = true;
        List <int> OutFileInfoID_List = new List <int>();

        if (tbFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                string         extension    = "";
                string[]       ary          = uploadedFile.FileName.Split('.');
                if (ary.Length > 1)
                {
                    extension = ary.Last();
                }

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }

                NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
                string contentType = tbFile.PostedFile.ContentType;
                OutFileInfoID = WS.UploadFile(1, contentType, extension, uploadedFile.FileName, user.ID, user.OrgID, fileData);

                if (OutFileInfoID < 1)
                {
                    UploadFileSuccess = false;
                    break;
                }
                else
                {
                    OutFileInfoID_List.Add(OutFileInfoID);
                }
            }
        }

        string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());

        int Chk = 0;

        if (UploadFileSuccess == true)
        {
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_CertificateM_xAddApplyData", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@CaseUserID", CaseUserID);
                    cmd.Parameters.AddWithValue("@CaseUserChName", CaseUserChName);
                    cmd.Parameters.AddWithValue("@CaseUserEnName", CaseUserEnName);
                    cmd.Parameters.AddWithValue("@ApplyUserName", ApplyUserName);
                    cmd.Parameters.AddWithValue("@UserRelationship", UserRelationship);
                    cmd.Parameters.AddWithValue("@CreatedUserID", user.ID);
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    cmd.Parameters.AddWithValue("@FileInfoIDs", OutFileInfoIDs);

                    SqlParameter sp = cmd.Parameters.AddWithValue("@Chk", Chk);
                    sp.Direction = ParameterDirection.Output;

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

                    Chk = (int)sp.Value;
                }
            }
        }

        if (UploadFileSuccess && Chk > 0)
        {
            script = "<script>alert('儲存成功');location.href = '/System/DocumentM/DocumentMaintain.aspx';</script><style>body{display:none;}</style>";
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }



        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
Ejemplo n.º 13
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"))
        {
            if (this.IsPostBack == false)
            {
                int.TryParse(Request.Form["c"], out CaseUserID);
                int.TryParse(Request.Form["i"], out RecordDataID);
                VaccineCode     = Request.Form["r"] ?? "";
                AppointmentDate = Request.Form["a"] ?? "";
                AppointmentDate = AppointmentDate.Equals("") ? Request.Form["aa"] ?? "": AppointmentDate;
                DateTime date    = default(DateTime);
                bool     success = DateTime.TryParse(AppointmentDate, out date);
                AppointmentDate = date.ToShortTaiwanDate();


                lblVC.Text = VaccineCode;
                lblAD.Text = AppointmentDate;
                hfc.Value  = CaseUserID.ToString();
                hfi.Value  = RecordDataID.ToString();
                hfr.Value  = VaccineCode;
                hfa.Value  = AppointmentDate;

                if (success == false || CaseUserID == 0 || RecordDataID == 0)
                {
                    string script = "<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_ReRecordReason"))
                {
                    var codes = SystemCode.dict["RecordM_ApplyRecord_ReRecordReason"];

                    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"];

                    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"];

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

            user = AuthServer.GetLoginUser();

            DataTable dt = new DataTable();

            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_RecordM_xGetDefaultBatchVaccineByOrgID", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(dt);
                    }
                }
            }

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

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

            Agency   = SystemOrg.GetName(user.OrgID);
            AgencyID = user.OrgID;
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET");
        base.DisableTop(false);
        base.BodyClass = "class='bodybg'";

        var user = AuthServer.GetLoginUser();

        int AgencyInfoID = 0;

        int.TryParse(Request["i"], out AgencyInfoID);
        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 = new DataTable();

        using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
        {
            using (SqlCommand cmd = new SqlCommand("dbo.usp_ParameterM_xGetVaccineByAgencyID", sc))
            {
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.AddWithValue("@AgencyInfoID", AgencyInfoID);
                using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                {
                    sc.Open();
                    da.Fill(dt);
                }
            }
        }

        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 = Newtonsoft.Json.JsonConvert.SerializeObject(list);
    }
Ejemplo n.º 15
0
    protected void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("POST");
        base.DisableTop(true);
        int    pgNow;
        int    pgSize;
        int    CountyID = 0;
        int    TownID   = 0;
        string BirthDateS;
        string BirthDateE;
        string CaseName;
        string CaseIdNo;
        string SearchReason;
        string SearchConditions = "";
        int    SearchKind       = 1;
        int    IsSearch         = 0;

        BirthDateS = Request.Form["BirthDateS"] ?? "";
        BirthDateE = Request.Form["BirthDateE"] ?? "";
        if (BirthDateS != "")
        {
            try
            {
                // BirthDateS = Convert.ToDateTime(BirthDateS).ToString("yyyyMMdd");
                BirthDateS = TaiwanYear.ToDateTime(BirthDateS).ToString("yyyyMMdd");
            }
            catch {
                BirthDateS = "";
            }
        }
        if (BirthDateE != "")
        {
            try
            {
                //BirthDateE = Convert.ToDateTime(BirthDateE).ToString("yyyyMMdd");
                BirthDateE = TaiwanYear.ToDateTime(BirthDateE).ToString("yyyyMMdd");
            }
            catch
            {
                BirthDateE = "";
            }
        }

        CaseName = Request.Form["CaseName"] ?? "";
        CaseIdNo = Request.Form["CaseIdNo"] ?? "";


        int.TryParse(Request.Form["pgNow"], out pgNow);
        int.TryParse(Request.Form["pgSize"], out pgSize);
        int.TryParse(Request.Form["CountyID"], out CountyID);
        int.TryParse(Request.Form["TownID"], out TownID);
        int.TryParse(Request.Form["IsSearch"], out IsSearch);
        SearchReason = Request.Form["SearchReason"] ?? "";

        int.TryParse(Request.Form["SearchKind"], out SearchKind);

        List <UserProfileListVM> list = new List <UserProfileListVM>();
        PageVM  rtn = new PageVM();
        DataSet ds  = new DataSet();

        int SearcResultCount = 0;

        try
        {
            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_CaseUser_xGetUserList", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@pgNow", pgNow == 0 ? 1 : pgNow);
                    cmd.Parameters.AddWithValue("@pgSize", pgSize == 0 ? 10 : pgSize);
                    cmd.Parameters.AddWithValue("@BirthDateS", BirthDateS);
                    cmd.Parameters.AddWithValue("@BirthDateE", BirthDateE);
                    cmd.Parameters.AddWithValue("@CaseName", CaseName);
                    cmd.Parameters.AddWithValue("@CaseIdNo", CaseIdNo);
                    cmd.Parameters.AddWithValue("@CountyID", CountyID);
                    cmd.Parameters.AddWithValue("@TownID", TownID);
                    //cmd.Parameters.AddWithValue("@IsSearch", IsSearch);
                    //cmd.Parameters.AddWithValue("@SearchReason", SearchReason);

                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(ds);
                    }
                }
            }

            SearcResultCount = Convert.ToInt32(ds.Tables[1].Rows[0][0]);
            // SearcResultCount = 0;

            EntityS.FillModel(list, ds.Tables[0]);
            EntityS.FillModel(rtn, ds.Tables[1]);
        }
        catch
        {
        }
        finally {
            //記下查詢紀錄

            if (IsSearch == 1)
            {
                if (CaseName != "")
                {
                    SearchConditions += "姓名:" + CaseName;
                }
                if (CaseIdNo != "")
                {
                    SearchConditions += "身份證號:" + CaseIdNo;
                }
                if (BirthDateS != "")
                {
                    SearchConditions += "生日起日:" + BirthDateS;
                }
                if (BirthDateE != "")
                {
                    SearchConditions += "生日迄日:" + BirthDateE;
                }
                if (CountyID != 0)
                {
                    SearchConditions += "戶籍縣市:" + SystemAreaCode.GetName(CountyID);
                }
                if (TownID != 0)
                {
                    SearchConditions += "戶籍鄉鎮:" + SystemAreaCode.GetName(TownID);
                }

                Session["SearchID"] = Convert.ToInt32(DBUtil.DBOp("ConnDB", " exec [dbo].[usp_CaseUser_xAddSearchLog] {0}, {1}, {2} ,{3} ,{4}  ", new string[] { AuthServer.GetLoginUser().ID.ToString(), SearchConditions, SearchReason, SearcResultCount.ToString(), SearchKind.ToString() }, NSDBUtil.CmdOpType.ExecuteScalar));
            }
        }
        rtn.message = list;

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

        DateTime AssessmentDate = DateTime.Now;

        int    SelfOrFamily          = GetNumber <int>("sf");
        int    CaseUserID            = GetNumber <int>("cc");
        int    AssessmentUserID      = GetNumber <int>("au");
        int    SystemRecordVaccineID = GetNumber <int>("ri");
        string AssessmentUserName    = GetString("aun");
        int    UpdateUID             = GetNumber <int>("uu");

        //DateTime.TryParse(Request.Form["AD"], out AssessmentDate);
        //.TryParseExact((GetString("ad")  ?? DateTime.Now.ToShortTaiwanDate()).RepublicToAD(),
        DateTime.TryParseExact((GetString("ad") ?? new DateTime(2099, 1, 1, 1, 1, 1, 0).ToShortTaiwanDate()).RepublicToAD(),
                               "yyyyMMdd",
                               CultureInfo.InvariantCulture,
                               DateTimeStyles.None,
                               out AssessmentDate);

        bool   AllowWork          = GetNumber <int>("aw") == 1 ? true :false;
        string ApplyHealthCateIDs = GetString("ah");
        bool   IsValid            = false;

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

            IsValid = true;
        }
        catch
        {
        }


        string OtherState   = GetString("os");
        int    RecordDataID = GetNumber <int>("rd");

        if (UpdateUID == 0)
        {
            if (IsValid == false || AssessmentUserID == 0 || AssessmentDate == default(DateTime) || RecordDataID == 0)
            {
                OPVM VMerr = new OPVM();
                VMerr.chk            = 0;
                Response.ContentType = "application/json; charset=utf-8";
                Response.Write(JsonConvert.SerializeObject(VMerr));
                Response.End();
            }
        }

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

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

        MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_RecordM_xAddOrUpdateApplyHealth"
                             , ref OutDict
                             , new Dictionary <string, object>()
        {
            { "@ApplyHealthID", UpdateUID },
            { "@AssessmentUserID", AssessmentUserID },
            { "@AssessmentDate", AssessmentDate },
            { "@CreatedUserID", user.ID },
            { "@AllowWork", AllowWork },
            { "@ApplyHealthCateIDs", ApplyHealthCateIDs },
            { "@OtherState", OtherState },
            { "@RecordDataID", RecordDataID },
            { "@OrgID", user.OrgID },
            { "@CaseUserID", CaseUserID },
            { "@SelfOrFamily", SelfOrFamily },
            { "@SystemRecordVaccineID", SystemRecordVaccineID }
        });

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

        OPVM VM = new OPVM();

        VM.chk = Chk;
        if (UpdateUID > 0)
        {
            Dictionary <string, object> dict = new Dictionary <string, object>();
            dict["I"]  = UpdateUID;
            dict["AD"] = AssessmentDate;
            dict["N"]  = AssessmentUserName;
            dict["ON"] = user.OrgName;
            dict["AS"] = "," + ApplyHealthCateIDs.Trim(',') + ",";
            dict["OS"] = OtherState;
            dict["AW"] = AllowWork;
            VM.obj     = dict;
        }
        Response.ContentType = "application/json; charset=utf-8";
        Response.Write(JsonConvert.SerializeObject(VM));
        Response.End();
    }
Ejemplo n.º 17
0
    protected override void OnInitComplete(EventArgs e)
    {
        bool HasPower = false;

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

        var dictHasPowerCount = 0;

        //List<string> urls = new List<string>();
        Dictionary <string, bool> urls = new Dictionary <string, bool>();

        foreach (var item in dict)
        {
            if (urls.ContainsKey(item.Key.PageUrl) == false)
            {
                urls[item.Key.PageUrl] = false;
            }

            item.Value.HasPower = CheckPower(item.Key.PageUrl, item.Key.myPowerEnum);

            if (item.Value.HasPower == true)
            {
                dictHasPowerCount++;
            }

            if (item.Key.myPowerEnum == MyPowerEnum.瀏覽)
            {
                urls[item.Key.PageUrl] = true;
            }
        }



        if (Request.Path.ToLower().Equals("/home.aspx") == true || Request.Path.ToLower().Equals("/leftmenu.aspx") == true || Request.Path.ToLower().Equals("/topheader.aspx") == true)
        {
            HasPower = true;
        }
        else
        {
            if (dict.Count > 0)
            {
                if ((dictHasPowerCount == dict.Count) || (powerLogicType == PowerLogicType.OR && dictHasPowerCount >= 1))
                {
                    HasPower = true;
                }

                foreach (var item in urls)
                {
                    if (item.Value == false)
                    {
                        HasPower = CheckPower(item.Key, MyPowerEnum.瀏覽);
                        if (powerLogicType == PowerLogicType.OR && HasPower == true)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                HasPower = CheckPower(Request.Path, MyPowerEnum.瀏覽);
            }
        }

        if (HasPower == false)
        {
            UserVM user = AuthServer.GetLoginUser();
            if (user != null)
            {
                throw new HttpException(404, "Not found");
                //Response.Redirect("~/Login.aspx");
            }
            else
            {
                throw new HttpException(404, "Not found");
                //Response.Redirect("~/html/ErrorPage/NoPower.html");
            }
            //string myScript = "<script>alert('您無權操作此頁面');history.go(-1);</script>";
            //Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "DisableTop", myScript, false);
        }
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string script  = "";
        string message = CheckValid();

        if (message.Length > 0)
        {
            script = "<script>alert('" + message + "');</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
            return;
        }

        int    CheckState       = PureNumber <int>(rbList.SelectedValue);
        bool   IsBusiness       = cbP.Checked;
        string UserName         = PureString(tbName.Text);
        string RocID            = PureString(tbRID.Text);
        string PhoneNumber      = PureString(tbPhone.Text);
        string Email            = PureString(tbEmail.Text);
        string Title            = PureString(tbTitle.Text);
        string ApplyReason      = PureString(tbReason.Text);
        string CheckDescription = PureString(tbDesp.Text);

        List <int> roleList = new List <int>();

        foreach (ListItem listItem in cbList.Items)
        {
            if (listItem.Selected)
            {
                int value = 0;
                int.TryParse(listItem.Value, out value);
                if (value > 0)
                {
                    roleList.Add(value);
                }
            }
        }


        UserVM user = AuthServer.GetLoginUser();
        //int OutFileInfoID = 0;
        //bool UploadFileSuccess = true;
        int Chk = 0;

        //List<int> OutFileInfoID_List = new List<int>();

        //if (tbFile.HasFile == true)
        //{
        //    HttpFileCollection multipleFiles = Request.Files;
        //    for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
        //    {

        //        //string fileName = Path.GetFileName(uploadedFile.FileName);
        //        //if (uploadedFile.ContentLength > 0)
        //        //{
        //        //    uploadedFile.SaveAs(Server.MapPath("~/Files/") + fileName);
        //        //    Label1.Text += fileName + "Saved <BR>";
        //        //}

        //        HttpPostedFile uploadedFile = multipleFiles[fileCount];
        //        string extension = "";
        //        //string[] ary = tbFile.FileName.Split('.');
        //        string[] ary = uploadedFile.FileName.Split('.');
        //        if (ary.Length > 1)
        //        {
        //            extension = ary.Last();
        //        }

        //        byte[] fileData = null;
        //        using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
        //        {
        //            fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
        //        }

        //        NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
        //        string contentType = tbFile.PostedFile.ContentType;
        //        OutFileInfoID = WS.UploadFile(1, contentType, extension, uploadedFile.FileName, user.ID, user.RoleID, fileData);

        //        if (OutFileInfoID < 1)
        //        {
        //            UploadFileSuccess = false;
        //            break;
        //        }
        //        else
        //        {
        //            OutFileInfoID_List.Add(OutFileInfoID);
        //        }
        //    }
        //}

        //string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());

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

        MSDB.ExecuteNonQuery("ConnUser", "dbo.usp_AccountM_xUpdateAccountInfo"
                             , ref OutDict
                             , new Dictionary <string, object>()
        {
            { "@UserID", ID },
            { "@UserName", UserName },
            { "@RocID", RocID },
            { "@PhoneNumber", PhoneNumber },
            { "@Email", Email },
            { "@Title", Title },
            { "@RoleIDs", string.Join(",", roleList.ConvertAll((item) => { return(item.ToString()); })) },
            { "@ApplyReason", ApplyReason },
            { "@CheckState", CheckState },
            { "@CheckDescription", CheckDescription },
            { "@IsBusiness", IsBusiness },
            //{ "@FileInfoIDs", OutFileInfoIDs }
        });

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



        if (Chk > 0)
        {
            script = "<style>body{display:none;}</style><script>alert('儲存成功');location.href = '/System/AccountM/AccountMaintain.aspx?i=" + ID + "';</script>";
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        if (IsValid == false)
        {
            return;
        }

        string checkScript = "";
        string message     = CheckValid();

        if (message.Length > 0)
        {
            checkScript = "<script>alert('" + message + "');</script>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", checkScript, false);
            return;
        }

        string title       = PureString(tbTitle.Text);
        string description = PureString(tbDesp.Text);

        int         state  = 0;
        RadioButton thisRb = null;

        thisRb = MyForm.Controls.OfType <RadioButton>().FirstOrDefault(rb => rb.Checked);
        if (thisRb != null)
        {
            switch (thisRb.ID)
            {
            case "rb1":
                state = 1;
                break;

            case "rb2":
                state = 2;
                break;
            }
        }

        UserVM user              = AuthServer.GetLoginUser();
        int    OutFileInfoID     = 0;
        bool   UploadFileSuccess = true;
        int    Chk = 0;

        List <int>    OutFileInfoID_List = new List <int>();
        StringBuilder errorSb            = new StringBuilder();
        string        errMsg             = "";

        if (tbFile.HasFile == true)
        {
            List <string> list = new List <string>()
            {
                "application/pdf",
                "application/msword",
                "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
                "application/vnd.ms-excel",
                "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
            };

            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                //string fileName = Path.GetFileName(uploadedFile.FileName);
                //if (uploadedFile.ContentLength > 0)
                //{
                //    uploadedFile.SaveAs(Server.MapPath("~/Files/") + fileName);
                //    Label1.Text += fileName + "Saved <BR>";
                //}

                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                string         extension    = "";
                //string[] ary = tbFile.FileName.Split('.');
                string[] ary = uploadedFile.FileName.Split('.');
                if (ary.Length > 1)
                {
                    extension = ary.Last();
                }

                if (list.Contains(uploadedFile.ContentType) == false)
                {
                    errorSb.Append("alert('上傳格式限PDF、WORD、EXCEL');");
                }

                if (uploadedFile.ContentLength > 3 * 1024 * 1024)
                {
                    errorSb.Append("alert('大小限3M以內');");
                }
                errMsg = errorSb.ToString();
                if (errMsg.Length > 0)
                {
                    break;
                }

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }

                NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
                string contentType = tbFile.PostedFile.ContentType;
                OutFileInfoID = WS.UploadFile(1, contentType, extension, uploadedFile.FileName, user.ID, user.RoleID, fileData);

                if (OutFileInfoID < 1)
                {
                    UploadFileSuccess = false;
                    break;
                }
                else
                {
                    OutFileInfoID_List.Add(OutFileInfoID);
                }
            }
        }

        if (errMsg.Length > 0)
        {
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", "<script>" + errMsg + "</script>", false);
            return;
        }

        string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());


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

            MSDB.ExecuteNonQuery("ConnDB", "dbo.usp_DocumentM_xUpdateDocumentInfo"
                                 , ref OutDict
                                 , new Dictionary <string, object>()
            {
                { "@DocTitle", title },
                { "@PublishState", state },
                { "@DocDescription", description },
                { "@DocumentInfoID", ID },
                { "@FileInfoIDs", OutFileInfoIDs }
            });

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

        string script = "";

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

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
Ejemplo n.º 20
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)
        {
            if (Request.Path.ToLower().Equals("/home.aspx") == true || Request.Path.ToLower().Equals("/leftmenu.aspx") == true || Request.Path.ToLower().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.º 21
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");

        if (Request.HttpMethod.Equals("POST"))
        {
            PageUrl        = QueryStringEncryptToolS.Decrypt(GetString("p"));
            EncryptPageUrl = QueryStringEncryptToolS.Encrypt(PageUrl);

            HasViewPower = CheckPower(PageUrl, MyPowerEnum.瀏覽);
            if (HasViewPower == false)
            {
                throw new HttpException(404, "Not found");
            }
            HasSearchPower = CheckPower(PageUrl, MyPowerEnum.查詢);

            var       user = AuthServer.GetLoginUser();
            DataTable dt   = new DataTable();

            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnUser"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("dbo.usp_PowerM_xGetOrgByOrgID", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(dt);
                    }
                }
            }

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

            //var all = SystemOrg.list;
            //int minValue = 0;
            //int maxValue = 0;
            //if (all.Count > 0)
            //{
            //    minValue = all[0].PID;
            //    maxValue = all[all.Count-1].PID;
            //}
            //IEnumerable<SystemOrgVM> conditionList = new List<SystemOrgVM>() { SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID) };
            //IEnumerable<SystemOrgVM> queryList = new List<SystemOrgVM>();
            //List<SystemOrgVM> FinalList = new List<SystemOrgVM>() { SystemOrg.GetVM(AuthServer.GetLoginUser().OrgID) };
            //int maxLevel = 10;
            //int i = 0;
            //do
            //{
            //    queryList = GetChild(all, conditionList, minValue, maxValue);
            //    FinalList.AddRange(queryList);
            //    conditionList = queryList;
            //    i++;
            //} while (queryList.Count() > 0 && i < maxLevel);

            list       = list.Where(item => item.OrgLevel < 5).ToList();
            MyTreeData = JsonConvert.SerializeObject(list);
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }
Ejemplo n.º 22
0
    protected void Page_Load(object sender, EventArgs e)
    {
        DownloadPower = base.AddPower(DownloadPower);
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        UserVM user = AuthServer.GetLoginUser();

        DealHospitalName.Text = HttpUtility.HtmlEncode(Request.Form[DealHospitalName.UniqueID]);

        if (this.IsPostBack == false)
        {
            if (SystemCode.dict.ContainsKey("StockManagementM_FroIdx"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_FroIdx"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    FroIdx.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }
            if (SystemCode.dict.ContainsKey("StockManagementM_MonIdx"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_MonIdx"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    MonIdx.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }
            if (SystemCode.dict.ContainsKey("StockManagementM_OriFroIdx"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_OriFroIdx"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    OriFroIdx.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }
            if (SystemCode.dict.ContainsKey("StockManagementM_DealType"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_DealType"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    DealType.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }

            int VaccOutBatchDataID;

            HttpUtility.HtmlEncode(int.TryParse(Request.QueryString["VaccOutBatchDataID"], out VaccOutBatchDataID));

            DataSet ds = new DataSet();

            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("usp_VaccineOut_xGetVaccineOutBatchData", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", VaccOutBatchDataID);
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(ds);
                    }
                }
            }
            DataTable dt  = ds.Tables[0];
            DataTable dt1 = ds.Tables[1];
            if (dt.Rows.Count > 0)
            {
                VaccineID.Text = dt.Rows[0]["VaccineID"].ToString();
                BatchType.Text = dt.Rows[0]["BatchType"].ToString();
                BatchID.Text   = dt.Rows[0]["BatchID"].ToString();
                FormDrug.Text  = dt.Rows[0]["FormDrug"].ToString();
                Storage.Text   = dt.Rows[0]["Storage"].ToString();
            }
            if (dt1.Rows.Count > 0)
            {
                DealDate.Text          = dt1.Rows[0]["DealDate"].ToString();
                DealType.SelectedValue = dt1.Rows[0]["DealType"].ToString();
                if (DealType.SelectedValue == "4")
                {
                    DealHospitalName.Visible = true;
                    DealHospitalID.Value     = dt1.Rows[0]["DealHospital"].ToString();
                    int dealHospitalID = 0;
                    int.TryParse(DealHospitalID.Value, out dealHospitalID);
                    DealHospitalName.Text = SystemOrg.GetName(dealHospitalID);
                }
                Remark.Text              = dt1.Rows[0]["Remark"].ToString();
                Num.Text                 = dt1.Rows[0]["Num"].ToString();
                TempHigh.Text            = Convert.ToDouble(dt1.Rows[0]["TempHigh"]).ToString();
                FroIdx.SelectedValue     = dt1.Rows[0]["FroIdx"].ToString();
                TempLow.Text             = Convert.ToDouble(dt1.Rows[0]["TempLow"]).ToString();
                OriFroIdx.SelectedValue  = dt1.Rows[0]["OriFroIdx"].ToString();
                MonIdx.SelectedValue     = dt1.Rows[0]["MonIdx"].ToString();
                DownloadFile.PostBackUrl = "/Vaccine/StockManagementM/VaccineOut/DownloadFileOP.aspx?i=" + dt1.Rows[0]["FileInfoID"].ToString();
                DownloadFile.Text        = dt1.Rows[0]["DisplayFileName"].ToString();
            }
        }
        DealType.Enabled  = false;
        FroIdx.Enabled    = false;
        OriFroIdx.Enabled = false;
        MonIdx.Enabled    = false;
    }
    protected 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 = 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.º 24
0
    protected void Save_Click(object sender, EventArgs e)
    {
        UserVM user    = AuthServer.GetLoginUser();
        string script  = "";
        string message = CheckNeeded();

        if (message.Length > 0)
        {
            script = "<script>alert('" + message + "');</script>";
            Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", script, false);
            return;
        }

        int  OutFileInfoID     = 0;
        bool UploadFileSuccess = true;
        int  Success           = 0;

        List <int> OutFileInfoID_List = new List <int>();

        if (tbFile.HasFile == true)
        {
            HttpFileCollection multipleFiles = Request.Files;
            for (int fileCount = 0; fileCount < multipleFiles.Count; fileCount++)
            {
                HttpPostedFile uploadedFile = multipleFiles[fileCount];
                string         extension    = "";
                string[]       ary          = uploadedFile.FileName.Split('.');
                if (ary.Length > 1)
                {
                    extension = ary.Last();
                }

                byte[] fileData = null;
                using (var binaryReader = new BinaryReader(uploadedFile.InputStream))
                {
                    fileData = binaryReader.ReadBytes(uploadedFile.ContentLength);
                }

                NIIS_WS.WebServiceSoapClient WS = new NIIS_WS.WebServiceSoapClient();
                string contentType = tbFile.PostedFile.ContentType;
                OutFileInfoID = WS.UploadFile(3, contentType, extension, uploadedFile.FileName, user.ID, user.OrgID, fileData);

                if (OutFileInfoID < 1)
                {
                    UploadFileSuccess = false;
                    break;
                }
                else
                {
                    OutFileInfoID_List.Add(OutFileInfoID);
                }
            }
        }

        string OutFileInfoIDs = string.Join(",", OutFileInfoID_List.Select(x => x.ToString()).ToArray());

        int    questionType    = int.Parse(QuestionType.SelectedValue);
        string question        = Question.Text.Trim();
        string reply           = Reply.Text.Trim();
        int    publishedStatus = 0;

        if (PublishedStatus1.Checked == true)
        {
            publishedStatus = 1;
        }
        if (PublishedStatus2.Checked == true)
        {
            publishedStatus = 2;
        }

        int ID = 0;

        int.TryParse(Request.QueryString["I"], out ID);

        if (UploadFileSuccess == true)
        {
            DataSet ds = new DataSet();

            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("usp_QnAData_xAddQnAData", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", ID);
                    cmd.Parameters.AddWithValue("@QuestionType", questionType);
                    cmd.Parameters.AddWithValue("@Question", question);
                    cmd.Parameters.AddWithValue("@Answer", reply);
                    cmd.Parameters.AddWithValue("@FileInfoIDs", OutFileInfoIDs);
                    cmd.Parameters.AddWithValue("@QaStatus", publishedStatus);
                    cmd.Parameters.AddWithValue("@ModifyAccount", user.ID);
                    SqlParameter sp = cmd.Parameters.AddWithValue("@Success", Success);
                    sp.Direction = ParameterDirection.Output;
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        cmd.ExecuteNonQuery();
                        Success = (int)sp.Value;
                    }
                }
            }
        }

        if (UploadFileSuccess && Success > 0)
        {
            script = "<script>alert('儲存成功');location.href = '/System/FrequentlyAskedQuestionM/QnAData/QnAData.aspx';</script>";
        }
        else
        {
            script = "<script>alert('儲存失敗');</script>";
        }

        Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", script, false);
    }
    protected void btnSave_Click(object sender, EventArgs e)
    {
        string script = "";

        if (this.tbFile.HasFile == false)
        {
            script = "<script>alert('檔案無效');</style>";
            Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
        }


        HSSFWorkbook workbook = new HSSFWorkbook(this.tbFile.FileContent);
        var          sheet    = workbook.GetSheetAt(0);

        DataTable dt    = new DataTable();
        DataTable outDt = new DataTable();

        outDt.Columns.Add("失敗原因");
        outDt.Columns.Add("學校代碼");
        outDt.Columns.Add("學校名稱");
        outDt.Columns.Add("入學年度");
        outDt.Columns.Add("級別\r\n(1 = 新生, 2 = 二年級)");
        outDt.Columns.Add("BCG應補種人數");
        outDt.Columns.Add("BCG實際補種人數");

        outDt.Columns.Add("rHepB1應補種人數");
        outDt.Columns.Add("rHepB1實際補種人數");

        outDt.Columns.Add("rHepB2應補種人數");
        outDt.Columns.Add("rHepB2實際補種人數");

        outDt.Columns.Add("rHepB3應補種人數");
        outDt.Columns.Add("rHepB3實際補種人數");

        outDt.Columns.Add("5in1-1應補種人數");
        outDt.Columns.Add("5in1-1實際補種人數");

        outDt.Columns.Add("5in1-2應補種人數");
        outDt.Columns.Add("5in1-2實際補種人數");

        outDt.Columns.Add("5in1-3應補種人數");
        outDt.Columns.Add("5in1-3實際補種人數");

        outDt.Columns.Add("5in1-4應補種人數");
        outDt.Columns.Add("5in1-4實際補種人數");

        outDt.Columns.Add("Var應補種人數");
        outDt.Columns.Add("Var實際補種人數");

        outDt.Columns.Add("MMR1應補種人數");
        outDt.Columns.Add("MMR1實際補種人數");

        outDt.Columns.Add("MMR2應補種人數");
        outDt.Columns.Add("MMR2實際補種人數");

        outDt.Columns.Add("JE1應補種人數");
        outDt.Columns.Add("JE1實際補種人數");

        outDt.Columns.Add("JE2應補種人數");
        outDt.Columns.Add("JE2實際補種人數");

        outDt.Columns.Add("JE3應補種人數");
        outDt.Columns.Add("JE3實際補種人數");

        outDt.Columns.Add("JE4應補種人數");
        outDt.Columns.Add("JE4實際補種人數");

        outDt.Columns.Add("Tdap-IPV應補種人數");
        outDt.Columns.Add("Tdap-IPV實際補種人數");



        var headerRow = sheet.GetRow(1);
        int cellCount = headerRow.LastCellNum;

        for (int i = headerRow.FirstCellNum; i < cellCount; i++)
        {
            DataColumn dc = new DataColumn(headerRow.GetCell(i).ToString());
            if (i >= 4)
            {
                if (i % 2 == 1)
                {
                    dc.ColumnName = sheet.GetRow(0).GetCell(i - 1).ToString() + dc.ColumnName;
                }
                else
                {
                    dc.ColumnName = sheet.GetRow(0).GetCell(i).ToString() + dc.ColumnName;
                }
            }
            else
            {
                dc.ColumnName = sheet.GetRow(0).GetCell(i).ToString();
            }
            dt.Columns.Add(dc);
        }

        int rowCount = sheet.LastRowNum;

        for (int i2 = 2; i2 <= sheet.LastRowNum; i2++)
        {
            var     row = sheet.GetRow(i2);
            DataRow dr  = dt.NewRow();

            for (int j = row.FirstCellNum; j < cellCount; j++)
            {
                if (row.GetCell(j) != null)
                {
                    dr[j] = row.GetCell(j).ToString();
                }
            }

            dt.Rows.Add(dr);
        }

        workbook = null;
        sheet    = null;


        ElementaryRecordVM VM = new ElementaryRecordVM();

        foreach (DataRow item in dt.Rows)
        {
            int Chk = 0;

            try
            {
                VM.SchoolCode    = item[0].ToString();
                VM.SchoolName    = item[1].ToString();
                VM.AdmissionYear = int.Parse(item[2].ToString());
                VM.StudentYear   = int.Parse(item[3].ToString());

                List <ElementaryRecordDataVM> list = new List <ElementaryRecordDataVM>();
                for (int i = 4; i <= dt.Columns.Count - 1; i++)
                {
                    ElementaryRecordDataVM child = new ElementaryRecordDataVM();
                    switch (i)
                    {
                    case 4:
                    case 5:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 1;
                        break;

                    case 6:
                    case 7:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 2;
                        break;

                    case 8:
                    case 9:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 3;
                        break;

                    case 10:
                    case 11:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 4;
                        break;

                    case 12:
                    case 13:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 9;
                        break;

                    case 14:
                    case 15:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 10;
                        break;

                    case 16:
                    case 17:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 11;
                        break;

                    case 18:
                    case 19:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 12;
                        break;

                    case 20:
                    case 21:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 13;
                        break;

                    case 22:
                    case 23:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 14;
                        break;

                    case 24:
                    case 25:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 15;
                        break;

                    case 26:
                    case 27:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 16;
                        break;

                    case 28:
                    case 29:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 17;
                        break;

                    case 30:
                    case 31:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 18;
                        break;

                    case 32:
                    case 33:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 19;
                        break;

                    case 34:
                    case 35:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 20;
                        break;

                    case 36:
                    case 37:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 21;
                        break;

                    case 38:
                    case 39:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 22;
                        break;

                    case 40:
                    case 41:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 23;
                        break;

                    case 42:
                    case 43:
                        child.VaccineDataID = 1;
                        child.VaccineType   = 24;
                        break;
                    }

                    child.InoculationNumber       = int.Parse(item[i].ToString());
                    child.ShouldInoculationNumber = child.InoculationNumber;

                    list.Add(child);
                }

                var user = AuthServer.GetLoginUser();



                using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
                {
                    using (SqlCommand cmd = new SqlCommand("dbo.usp_RecordM_xAddElementaryRecord", sc))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.AddWithValue("@ElementarySchoolID", 1);
                        cmd.Parameters.AddWithValue("@AdmissionYear", VM.AdmissionYear);
                        cmd.Parameters.AddWithValue("@StudentNumber", VM.StudentNumber);
                        cmd.Parameters.AddWithValue("@HasYellowCardNumber", VM.HasYellowCardNumber);
                        cmd.Parameters.AddWithValue("@SignUserID", user.ID);
                        cmd.Parameters.AddWithValue("@CreatedUserID", user.ID);
                        cmd.Parameters.AddWithValue("@StudentYear", VM.StudentYear);
                        cmd.Parameters.AddWithValue("@InoculationType", 2);
                        cmd.Parameters.AddWithValue("@VaccineTypeString", string.Join(",", list.Select(x => x.VaccineType.ToString())));
                        cmd.Parameters.AddWithValue("@InoculationNumberString", string.Join(",", list.Select(x => x.InoculationNumber.ToString())));
                        cmd.Parameters.AddWithValue("@ShouldInoculationNumberString", string.Join(",", list.Select(x => x.ShouldInoculationNumber.ToString())));
                        cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                        SqlParameter sp = cmd.Parameters.AddWithValue("@Chk", Chk);
                        sp.Direction = ParameterDirection.Output;

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

                        Chk = (int)sp.Value;
                    }
                }
            }
            catch
            {
            }


            if (Chk < 1)
            {
                List <object> list  = new List <object>();
                DataRow       drNew = outDt.NewRow();
                foreach (object obj in item.ItemArray)
                {
                    list.Add(obj);
                }
                list.Insert(0, "失敗");
                drNew.ItemArray = list.ToArray();
                outDt.Rows.Add(drNew);
            }
        }

        script = "";
        if (outDt.Rows.Count > 0)
        {
            //script = @"<script>
            //     var popUpWindow = function (url, title, w, h) {
            //         var left = (screen.width / 2) - (w / 2);
            //         var top = (screen.height / 2) - (h / 2);
            //         return window.open(url, title, 'toolbar=no,status=no,menubar=no,scrollbars=no,resizable=no,left=10000, top=10000, width=10, height=10, visible=none');
            //     };
            //    var openWindowWithPost  = function(url, title, w, h, keys, values) {
            //    var newWindow = popUpWindow(url, title, w, h);
            //    if (!newWindow) return false;
            //    var html = '';
            //    html += ""<html><head></head><body><form id='formid' method='post' target='_blank' action='"" + url + ""'>"";
            //    keys = keys || [];
            //    values = values || [];



            //       if (keys && values && (keys.length == values.length))
            //        for (var i = 0; i < keys.length; i++)
            //            html += ""<input type='hidden' name='"" + keys[i] + ""' value='"" + values[i] + ""'/>"";
            //        html += ""</form></body></html>"";
            //       newWindow.document.write(html);
            //       newWindow.document.getElementById('formid').submit();
            //       setTimeout(function(){
            //            newWindow.close();
            //       },1000);
            //       return newWindow;
            //    };";
            //script += @"alert('上傳失敗');
            //        var keys = [];
            //        var values = [];
            //        keys[0] = 'json';
            //        values[0] = encodeURI('" + JsonConvert.SerializeObject(outDt) + "');" +
            //        "  openWindowWithPost('/Ashx/JsonToExcel.ashx','_blank',100,100, keys, values);</script>";

            script += @"<script>alert('上傳失敗');  document.getElementById('json').value='" + JsonConvert.SerializeObject(outDt) + "';document.getElementById('formid').submit();</script>";
        }
        else
        {
            script = "<script>alert('上傳成功');location.href = '/Vaccination/RecordM/StudentRecord.aspx';</script><style>body{display:none;}</style>";
        }

        Page.ClientScript.RegisterClientScriptBlock(this.Page.GetType(), "alert", script, false);
    }
Ejemplo n.º 26
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");
        //}

        var dictHasPowerCount = 0;

        Dictionary <string, bool> urls = new Dictionary <string, bool>();

        foreach (var item in dict)
        {
            if (urls.ContainsKey(item.Key.PageUrl) == false)
            {
                urls[item.Key.PageUrl] = false;
            }

            item.Value.HasPower = CheckPower(item.Key.PageUrl, item.Key.myPowerEnum);

            if (item.Value.HasPower == true)
            {
                dictHasPowerCount++;
            }

            if (item.Key.myPowerEnum == MyPowerEnum.瀏覽)
            {
                urls[item.Key.PageUrl] = true;
            }
        }

        if (Request.Path.ToLower().Equals("/home.aspx") == true || Request.Path.ToLower().Equals("/leftmenu.aspx") == true || Request.Path.ToLower().Equals("/topheader.aspx") == true)
        {
            HasPower = true;
        }
        else
        {
            if (dict.Count > 0)
            {
                if ((dictHasPowerCount == dict.Count) || (powerLogicType == PowerLogicType.OR && dictHasPowerCount >= 1))
                {
                    HasPower = true;
                }

                foreach (var item in urls)
                {
                    if (item.Value == false)
                    {
                        HasPower = CheckPower(item.Key, MyPowerEnum.瀏覽);
                        if (powerLogicType == PowerLogicType.OR && HasPower == true)
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                HasPower = CheckPower(Request.Path, MyPowerEnum.瀏覽);
            }
        }

        if (HasPower == false)
        {
            UserVM user = AuthServer.GetLoginUser();
            if (user != null)
            {
                throw new HttpException(404, "Not found");
            }
            else
            {
                throw new HttpException(404, "Not found");
            }
        }
    }
Ejemplo n.º 27
0
    protected void BindData()
    {//<table>
        //<tbody><tr>
        //<th scope="col">疫苗別</th>
        //<th scope="col">訪查日期</th>
        //<th scope="col">訪查單位(人員)</th>
        //<th scope="col">訪查方式</th>
        //<th scope="col">訪查原因</th>
        //<th scope="col">訪查紀錄</th>
        //<th scope="col">附件</th>
        //<th scope="col">刪除</th>
        //</tr>
        //</tbody>
        //</table>
        int ViewOrgID = AuthServer.GetLoginUser().OrgID;

        CaseVisitTb.Controls.Clear();

        Table           tb  = new Table();
        TableRow        thr = new TableRow();
        TableHeaderCell th1 = new TableHeaderCell();

        th1.Text = "疫苗別"; thr.Cells.Add(th1);
        TableHeaderCell th2 = new TableHeaderCell();

        th2.Text = "訪查日期"; thr.Cells.Add(th2);
        TableHeaderCell th3 = new TableHeaderCell();

        th3.Text = "訪查單位(人員)"; thr.Cells.Add(th3);
        TableHeaderCell th4 = new TableHeaderCell();

        th4.Text = "訪查方式"; thr.Cells.Add(th4);
        TableHeaderCell th5 = new TableHeaderCell();

        th5.Text = "訪查原因"; thr.Cells.Add(th5);
        TableHeaderCell th6 = new TableHeaderCell();

        th6.Text = "訪查結果"; thr.Cells.Add(th6);
        TableHeaderCell th7 = new TableHeaderCell();

        th7.Text = "附件"; thr.Cells.Add(th7);
        tb.Controls.Add(thr);


        DataTable dt = (DataTable)
                       DBUtil.DBOp("ConnDB",
                                   @"exec [dbo].[usp_CaseVist_xCaseVisitListByDoseID] {0},{1}  "
                                   , new string[] {
            CaseID.ToString()
            , DoseID
        }, NSDBUtil.CmdOpType.ExecuteReaderReturnDataTable);


        foreach (DataRow r in dt.Rows)
        {
            TableRow  thd = new TableRow();
            TableCell td1 = new TableCell();
            td1.Text = r["疫苗別"].ToString(); thd.Cells.Add(td1);
            TableCell td2 = new TableCell();
            td2.Text = r["訪查日期"].ToString(); thd.Cells.Add(td2);
            TableCell td3 = new TableCell();
            td3.Text = r["訪查單位(人員)"].ToString(); thd.Cells.Add(td3);
            TableCell td4 = new TableCell();
            td4.Text = SystemCode.GetName("CaseVisit_VisitType", Convert.ToInt32(r["訪查方式"])); thd.Cells.Add(td4);

            TableCell td5 = new TableCell();
            td5.Text = SystemCode.GetName("CaseVisit_VisitReason", Convert.ToInt32(r["訪查原因"])); thd.Cells.Add(td5);
            TableCell td6 = new TableCell();
            td6.Text = SystemCode.GetName("CaseVisit_VisitResult_Reason_" + r["訪查原因"], Convert.ToInt32(r["訪查結果"])); thd.Cells.Add(td6);
            TableCell td7 = new TableCell();

            int VisitOrg;
            int.TryParse(r["VisitOrg"].ToString(), out VisitOrg);
            td7.Text = ShowFiles(Convert.ToInt32(r["VisitID"]), (VisitOrg == ViewOrgID)); thd.Cells.Add(td7);

            tb.Controls.Add(thd);
        }

        CaseVisitTb.Controls.Add(tb);
    }
Ejemplo n.º 28
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();
        }
    }
Ejemplo n.º 29
0
    protected void Page_Load(object sender, EventArgs e)
    {
        ModifyPower = base.AddPower(list[0]);
        UploadPower = base.AddPower(list[1]);
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        UserVM user = AuthServer.GetLoginUser();

        DealHospitalName.Text = HttpUtility.HtmlEncode(Request.Form[DealHospitalName.UniqueID]);

        if (this.IsPostBack == false)
        {
            DealDate.Attributes.Add("onclick", "WdatePicker({ dateFmt: 'yyyMMdd',maxDate:'" + DateTime.Now.ToString("yyyy-MM-dd") + "', lang: 'zh-tw' })");
            DealDateImg.Attributes.Add("onclick", "WdatePicker({ el:'" + DealDate.ClientID + "',dateFmt: 'yyyMMdd',maxDate:'" + DateTime.Now.ToString("yyyy-MM-dd") + "', lang: 'zh-tw' })");

            if (SystemCode.dict.ContainsKey("StockManagementM_FroIdx"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_FroIdx"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    FroIdx.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }
            if (SystemCode.dict.ContainsKey("StockManagementM_MonIdx"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_MonIdx"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    MonIdx.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }
            if (SystemCode.dict.ContainsKey("StockManagementM_OriFroIdx"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_OriFroIdx"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    OriFroIdx.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }
            if (SystemCode.dict.ContainsKey("StockManagementM_DealType"))
            {
                List <SystemCodeVM> SystemCodeList = SystemCode.dict["StockManagementM_DealType"];
                foreach (SystemCodeVM sc in SystemCodeList)
                {
                    DealType.Items.Add(new ListItem(sc.EnumName, sc.EnumValue.ToString()));
                }
            }

            int VaccInBatchDataID;

            HttpUtility.HtmlEncode(int.TryParse(Request.QueryString["BI"], out VaccInBatchDataID));

            DataSet ds = new DataSet();

            using (SqlConnection sc = new SqlConnection(WebConfigurationManager.ConnectionStrings["ConnDB"].ToString()))
            {
                using (SqlCommand cmd = new SqlCommand("usp_VaccineIn_xGetVaccineInBatchData", sc))
                {
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.AddWithValue("@ID", VaccInBatchDataID);
                    cmd.Parameters.AddWithValue("@OrgID", user.OrgID);
                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        sc.Open();
                        da.Fill(ds);
                    }
                }
            }
            DataTable dt  = ds.Tables[0];
            DataTable dt1 = ds.Tables[1];
            if (dt.Rows.Count > 0)
            {
                VaccineID.Text = dt.Rows[0]["VaccineID"].ToString();
                BatchType.Text = dt.Rows[0]["BatchType"].ToString();
                BatchID.Text   = dt.Rows[0]["BatchID"].ToString();
                FormDrug.Text  = dt.Rows[0]["FormDrug"].ToString();
                Storage.Text   = dt.Rows[0]["Storage"].ToString();
            }
            if (dt1.Rows.Count > 0)
            {
                DealDate.Text          = dt1.Rows[0]["DealDate"].ToString();
                DealType.SelectedValue = dt1.Rows[0]["DealType"].ToString();
                if (DealType.SelectedValue == "4")
                {
                    DealHospitalName.Visible = true;
                    DealHospitalImg.Visible  = true;
                    DealHospitalID.Value     = dt1.Rows[0]["DealHospital"].ToString();
                    int dealHospitalID = 0;
                    int.TryParse(DealHospitalID.Value, out dealHospitalID);
                    DealHospitalName.Text = SystemOrg.GetName(dealHospitalID);
                }
                Remark.Text             = dt1.Rows[0]["Remark"].ToString();
                Num.Text                = dt1.Rows[0]["Num"].ToString();
                TempHigh.Text           = Convert.ToDouble(dt1.Rows[0]["TempHigh"]).ToString();
                FroIdx.SelectedValue    = dt1.Rows[0]["FroIdx"].ToString();
                TempLow.Text            = Convert.ToDouble(dt1.Rows[0]["TempLow"]).ToString();
                OriFroIdx.SelectedValue = dt1.Rows[0]["OriFroIdx"].ToString();
                MonIdx.SelectedValue    = dt1.Rows[0]["MonIdx"].ToString();
            }
        }
        OriFroIdx.Enabled = false;
    }
Ejemplo n.º 30
0
    protected new void Page_Load(object sender, EventArgs e)
    {
        base.AllowHttpMethod("GET", "POST");
        base.DisableTop(false);

        string VaccineID = GetString("v");

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


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

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

                List <DefaultBatchVaccineVM> outList = new List <DefaultBatchVaccineVM>();
                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].Storage += item.Storage;
                    }
                }

                outList.RemoveAll((item) => item.Storage == 0);
                tbAry = JsonConvert.SerializeObject(outList);
            }
        }
        else
        {
            Response.Write("");
            Response.End();
        }
    }