コード例 #1
0
        private void InitCtrl()
        {
            //DataSet dsProject = ApplicationDAL.GetProjectList();
            //this.ddlProject.DataSource = dsProject;
            //this.ddlProject.DataBind();
            //Session["dsProject"] = dsProject;

            this.CreateDropdownListGroup();

            //DataSet dsLoction = ApplicationDAL.GetLoctionList("1");
            //this.ddlLocation.DataSource = dsLoction;
            //this.ddlLocation.DataBind();
            //Session["dsLoction"] = dsLoction;
            //ddlLocation_SelectedIndexChanged(null, null);

            lblStatus.Text = "未提交";


            this.txtName.Enabled   = false;
            this.txtMobile.Enabled = false;
            this.txtEmail.Enabled  = false;
            // New app
            if (Request.QueryString["guid"] == null)
            {
                // When create new application, using current login user context
                // When view and update, should use last saved user context
                V_Sys_UserMdl model = V_Sys_UserDAL.GetModel(Session["USER_GUID"].ToString());
                this.txtName.Text      = model.name;
                this.txtMobile.Text    = model.login_name;
                this.txtEmail.Text     = model.email;
                this.hidUserGUID.Value = Session["USER_GUID"].ToString();
            }

            // View and update app
            if (Request.QueryString["guid"] != null)
            {
                string guid = Request.QueryString["guid"];
                Consult_ApplicationDAL dal = new Consult_ApplicationDAL();
                Consult_ApplicationMdl mdl = dal.GetModel(guid);
                BindGUI(mdl);
            }
        }
コード例 #2
0
        private ApplicationAllInOneMdl GetMdlFromGUI()
        {
            ApplicationAllInOneMdl totalMdl = new ApplicationAllInOneMdl();

            // Basic info
            Consult_ApplicationMdl consultAppMdl = new Consult_ApplicationMdl();

            #region MyRegion
            // Try to get guid
            consultAppMdl.guid = this.hidGUID.Value.Trim();
            if (string.IsNullOrEmpty(consultAppMdl.guid))
            {
                // New Application Request
                consultAppMdl.guid       = Guid.NewGuid().ToString();
                consultAppMdl.created_dt = DateTime.Now;
                consultAppMdl.status     = 1; // After save, the status will be changed to 1;
                this.hidGUID.Value       = consultAppMdl.guid;
            }
            else
            {
                // Get exists data first, then using new GUI to update
                Consult_ApplicationDAL dal = new Consult_ApplicationDAL();
                consultAppMdl = dal.GetModel(consultAppMdl.guid);
                // Update status from 0 to 1
                if (consultAppMdl.status == 0)
                {
                    consultAppMdl.status = 1;
                }
            }

            consultAppMdl.location_type = int.Parse(this.ddlLocalType.SelectedValue);
            consultAppMdl.user_guid     = Session["USER_GUID"].ToString();
            consultAppMdl.user_name     = this.txtName.Text.Trim();
            consultAppMdl.purpose       = this.txtApplicationPurpose.Text;
            #endregion


            // Patient Info
            EMR_PatientMdl patientMdl = new EMR_PatientMdl();
            #region MyRegion
            patientMdl.user_guid = this.hidUserGUID.Value; // Pateint belongs to User
            patientMdl.name      = this.txtPatientName.Text.Trim();
            patientMdl.gender    = int.Parse(this.ddlGender.SelectedValue);
            string   strDOB = this.txtDOB.Text;
            DateTime dtDOB  = DateTime.Now;
            DateTime.TryParse(strDOB, out dtDOB);
            patientMdl.birthday = dtDOB;
            #endregion


            // Hospital Info
            List <Consult_Application_ConsultantMdl> consultantMdlCollection = new List <Consult_Application_ConsultantMdl>();
            #region MyRegion
            int HospitalCount = int.Parse(this.ddlHospitalCount.SelectedValue);
            for (int i = 1; i <= HospitalCount; i++)
            {
                Consult_Application_ConsultantMdl consultantMdl = new Consult_Application_ConsultantMdl();
                DropDownList ddlHospital = this.panDoctorGroup.FindControl("ddlHospital" + i.ToString()) as DropDownList;
                if (ddlHospital.SelectedItem != null)
                {
                    consultantMdl.hospital_guid = ddlHospital.SelectedValue;
                    consultantMdl.hospital_name = ddlHospital.SelectedItem.Text;
                    string location_guid = "";
                    string location_name = "";
                    Consult_ApplicationDAL.GetLocationInfoByHospitalUID(consultantMdl.hospital_guid, ref location_guid, ref location_name);
                    consultantMdl.location_guid = location_guid;
                    consultantMdl.location_name = location_name;
                }

                DropDownList ddlDoctor = this.panDoctorGroup.FindControl("ddlDoctor" + i.ToString()) as DropDownList;
                if (ddlDoctor.SelectedItem != null)
                {
                    consultantMdl.doctor_guid = ddlDoctor.SelectedValue;
                    consultantMdl.doctor_name = ddlDoctor.SelectedItem.Text;
                }
                consultantMdl.consult_application_guid = consultAppMdl.guid;
                consultantMdlCollection.Add(consultantMdl);
            }
            #endregion


            // consult_application_accessory info
            #region MyRegion
            consult_application_accessoryMdl thumbnailMdl = null;
            if (!string.IsNullOrEmpty(this.hidPurposeImg.Value) && File.Exists(this.hidPurposeImg.Value))
            {
                thumbnailMdl = new consult_application_accessoryMdl();
                if (string.IsNullOrEmpty(this.hidPurposeImgGUID.Value))
                {
                    thumbnailMdl.guid = Guid.NewGuid().ToString();
                }
                else
                {
                    thumbnailMdl.guid = this.hidPurposeImgGUID.Value;
                }

                thumbnailMdl.consult_application_guid = consultAppMdl.guid;
                thumbnailMdl.type      = 0;
                thumbnailMdl.content   = File.ReadAllBytes(this.hidPurposeImg.Value);
                thumbnailMdl.thumbnail = ImageUtils.getThumbnail(thumbnailMdl.content);
            }
            #endregion



            totalMdl.Consult_ApplicationMdl = consultAppMdl;
            totalMdl.EMR_PatientMdl         = patientMdl;
            totalMdl.Consult_Application_ConsultantMdlCollection = consultantMdlCollection;
            totalMdl.consult_application_accessoryMdl            = thumbnailMdl;
            return(totalMdl);
        }