Example #1
0
        private void HealthCheckPictureBox_Click(object sender, EventArgs e) //健康体检
        {
            if (string.IsNullOrEmpty(this.IDCardNo))
            {
                new MessageForm("请先刷身份证或输入身份证登录系统!")
                {
                    StartPosition = FormStartPosition.CenterParent
                }.ShowDialog();
                return;
            }
            //DateTime checkdt = DateTime.Parse(DateTime.Now.ToString("yyyy-MM-dd")).AddMonths(-3);
            DataSet customerds = new RecordsCustomerBaseInfoBLL().GetList(string.Format(" IDCardNo='{0}' and CheckDate between '{1}' and '{2}' order by CheckDate DESC ", this.IDCardNo, DateTime.Today.ToString("yyyy-01-01"), DateTime.Today.Date.ToString("yyyy-12-31")));

            // DataSet customerds = new RecordsCustomerBaseInfoBLL().GetList(string.Format(" IDCardNo='{0}' order by CheckDate desc  ", this.IDCardNo));

            if (customerds.Tables[0].Rows.Count > 0)
            {
                DataRow row         = customerds.Tables[0].Rows[0];
                string  strchekdate = DateTime.Parse(row["CheckDate"].ToString()).ToString("yyyy-MM-dd");
                if (MessageBox.Show("此人于'" + strchekdate + "'已体检,是否继续体检", "继续体检", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1) == DialogResult.No)
                {
                    return;
                }
            }

            PhysicalInfoFactory.ID     = 0;
            PhysicalInfoFactory.NewAdd = true;
            using (PEControler controler = new PEControler(new PhysicalForm(this.IDCardNo), new PhysicalInfoFactory()))
            {
                controler.IParentFrm.IShowDialog();
            }
            GC.Collect();
        }
        private void dgvData_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if ((this.bds.Position >= 0) && (e.RowIndex >= 0))
            {
                DataRowView view = (DataRowView)this.bds.List[this.bds.Position];

                if (((this.dgvData.Columns[e.ColumnIndex].HeaderText == "修改") && (this.bds.Position >= 0)) && (e.RowIndex >= 0))
                {
                    PhysicalInfoFactory.ID     = int.Parse(view.Row["ID"].ToString());
                    PhysicalInfoFactory.NewAdd = false;
                    using (PEControler controler = new PEControler(new PhysicalForm(view.Row["IDCardNo"].ToString()), new PhysicalInfoFactory()))
                    {
                        controler.IParentFrm.IShowDialog();
                        CheckData();
                    }
                    GC.Collect();
                }
                else if (((this.dgvData.Columns[e.ColumnIndex].HeaderText == "删除") && (this.bds.Position >= 0)) && (e.RowIndex >= 0))
                {
                    if (view != null)
                    {
                        DataRow row = view.Row;
                        if (MessageBox.Show("确定删除:" + row["CustomerName"].ToString() + "?删除之后的信息将无法恢复!", "删除", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                        {
                            int BaseID = Convert.ToInt32(row["ID"].ToString());
                            RecordsGeneralConditionModel GerneralCondition = new RecordsGeneralConditionBLL().GetModelByOutKey(BaseID);
                            if (GerneralCondition != null)
                            {
                                RecordsSelfcareabilityBLL RecordsSelfcareabilityBLL = new RecordsSelfcareabilityBLL();
                                RecordsSelfcareabilityBLL.Delete(GerneralCondition.SelfID);
                            }

                            RecordsMediPhysDistModel MediPhys = new RecordsMediPhysDistBLL().GetModelByOutKey(BaseID);
                            if (MediPhys != null)
                            {
                                RecordsMedicineCnBLL     MedicineCnBLL     = new RecordsMedicineCnBLL();
                                RecordsMedicineResultBLL MedicineResultBLL = new RecordsMedicineResultBLL();
                                MedicineCnBLL.Delete(MediPhys.MedicineID);
                                MedicineResultBLL.Delete(MediPhys.MedicineResultID);
                            }
                            RecordsSignatureModel Signature = new RecordsSignatureBLL().GetModelByOutKey(BaseID, row["IDCardNo"].ToString());
                            if (Signature != null)
                            {
                                if (Signature.FeedbackDate.HasValue)
                                {
                                    string strfbDate     = Convert.ToDateTime(Signature.FeedbackDate).ToString("yyyyMMdd");
                                    string strSign1_Self = String.Format("{0}{1}_{2}_B.png", SignPath, Signature.IDCardNo, strfbDate);
                                    if (File.Exists(strSign1_Self))  //如果存在则删除图片
                                    {
                                        File.Delete(strSign1_Self);
                                    }
                                    string strSign1_Js = String.Format("{0}{1}_{2}_J.png", SignPath, Signature.IDCardNo, strfbDate);
                                    if (File.Exists(strSign1_Js)) //如果存在则删除图片
                                    {
                                        File.Delete(strSign1_Js);
                                    }
                                    string strSign1_Fkr = String.Format("{0}{1}_{2}_F.png", SignPath, Signature.IDCardNo, strfbDate);
                                    if (File.Exists(strSign1_Fkr)) //如果存在则删除图片
                                    {
                                        File.Delete(strSign1_Fkr);
                                    }
                                    string strSign1_Ys = String.Format("{0}{1}_{2}_Doc.png", SignPath, Signature.IDCardNo, strfbDate);
                                    if (File.Exists(strSign1_Ys)) //如果存在则删除图片
                                    {
                                        File.Delete(strSign1_Ys);
                                    }
                                }
                            }
                            new RecordsCustomerBaseInfoBLL().Delete(BaseID);
                            row.Delete();
                            row.Table.AcceptChanges();
                            CheckData();
                        }
                    }
                }
            }
        }
Example #3
0
        public override bool DoSave()
        {
            BindingFlags bindingAttr = BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly;
            PhysicalForm iParentFrm  = base.IParentFrm as PhysicalForm;
            bool         flag        = true;

            base.SaveDataInfo = "保存失败!\r\n";
            IEnumerable <IGrouping <string, RecordsRequiredModel> > enumerable = from a in iParentFrm.Archive_requireds group a by a.BTable;

            foreach (KeyValuePair <string, IChildForm> pair in base.IChildrens)
            {
                if (pair.Value.EveryThingIsOk)
                {
                    pair.Value.SaveDataInfo = "";
                    pair.Value.UpdataToModel();
                    foreach (PropertyInfo info in pair.Value.GetType().GetProperties(bindingAttr))
                    {
                        if (info.PropertyType.Name.Contains("Records"))
                        {
                            using (IEnumerator <IGrouping <string, RecordsRequiredModel> > enumerator = enumerable.GetEnumerator())
                            {
                                while (enumerator.MoveNext())
                                {
                                    Predicate <RecordsRequiredModel>         match     = null;
                                    IGrouping <string, RecordsRequiredModel> tmp_model = enumerator.Current;
                                    if ((info.PropertyType.Name == tmp_model.Key) && ((pair.Key != "一般情况") || (tmp_model.Key != "RecordsPhysicalExamModel")))
                                    {
                                        object obj2 = info.GetValue(pair.Value, null);
                                        if (match == null)
                                        {
                                            match = req => req.BTable == tmp_model.Key;
                                        }
                                        foreach (RecordsRequiredModel archive_required in iParentFrm.Archive_requireds.FindAll(match))
                                        {
                                            decimal?nullable = archive_required.IsRequired;
                                            if (((nullable.GetValueOrDefault() != 0M) ? 0 : (nullable.HasValue ? 1 : 0)) == 0)
                                            {
                                                PropertyInfo property = obj2.GetType().GetProperty(archive_required.Name, bindingAttr);
                                                if (property != null)
                                                {
                                                    object obj3 = property.GetValue(obj2, null);
                                                    if (obj3 == null)
                                                    {
                                                        PEControler controler = this;
                                                        string      str       = controler.SaveDataInfo + archive_required.Comment + " :必填\r\n";
                                                        controler.SaveDataInfo = str;
                                                        flag = false;
                                                    }
                                                    else if (string.IsNullOrEmpty(obj3.ToString()))
                                                    {
                                                        PEControler controler2 = this;
                                                        string      str2       = controler2.SaveDataInfo + archive_required.Comment + " :必填\r\n";
                                                        controler2.SaveDataInfo = str2;
                                                        flag = false;
                                                    }
                                                }
                                                else
                                                {
                                                    PEControler controler3 = this;
                                                    string      str3       = controler3.SaveDataInfo + archive_required.Comment + " :必填\r\n";
                                                    controler3.SaveDataInfo = str3;
                                                    flag = false;
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (!flag)
                    {
                        return(false);
                    }
                    if (pair.Value.CheckErrorInput() == ChildFormStatus.HasErrorInput)
                    {
                        flag = false;
                        base.IParentFrm.ChildStatus(pair.Key, ChildFormStatus.HasErrorInput);
                        PEControler controler4 = this;
                        string      str4       = controler4.SaveDataInfo + pair.Value.SaveDataInfo;
                        controler4.SaveDataInfo = str4;
                    }
                }
            }
            if (!flag)
            {
                return(false);
            }
            foreach (KeyValuePair <string, IChildForm> pair2 in base.IChildrens)
            {
                if (pair2.Value.EveryThingIsOk)
                {
                    flag = pair2.Value.SaveModelToDB();
                }
            }
            if (!flag)
            {
                return(false);
            }
            IParentModel <RecordsBaseInfoModel> model = base.IParentFrm as IParentModel <RecordsBaseInfoModel>;

            if (model != null)
            {
                model.SaveModel();
            }
            return(flag);
        }