/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { ShafaCommon.Types.ShafaDateType shafaDateType1 = new ShafaCommon.Types.ShafaDateType(); ShafaCommon.Types.ShafaDateType shafaDateType2 = new ShafaCommon.Types.ShafaDateType(); this.bloodRegister_UI1 = new BloodPresentationLayer.UI_Control.BloodRegister_UI(); this.SuspendLayout(); // // bloodRegister_UI1 // this.bloodRegister_UI1._IsNew = true; this.bloodRegister_UI1.BloodGroup = ""; this.bloodRegister_UI1.BloodSerial = ""; shafaDateType1.Date = "1399/10/13"; shafaDateType1.DateShort = "99/10/13"; shafaDateType1.DateTime = "1399/10/13 19:25"; shafaDateType1.Day = ((short)(13)); shafaDateType1.Hour = ((short)(19)); shafaDateType1.IsValid = true; shafaDateType1.Minute = ((short)(25)); shafaDateType1.Mon = ((short)(10)); shafaDateType1.Time = "19:25"; shafaDateType1.Year = ((short)(99)); shafaDateType1.YearFull = 1399; this.bloodRegister_UI1.EditDate = shafaDateType1; this.bloodRegister_UI1.Location = new System.Drawing.Point(16, 42); this.bloodRegister_UI1.MinimumSize = new System.Drawing.Size(640, 510); this.bloodRegister_UI1.Name = "bloodRegister_UI1"; shafaDateType2.Date = "0000/00/00"; shafaDateType2.DateShort = "00/00/00"; shafaDateType2.DateTime = "0000/00/00 00:00"; shafaDateType2.Day = ((short)(0)); shafaDateType2.Hour = ((short)(0)); shafaDateType2.IsValid = false; shafaDateType2.Minute = ((short)(0)); shafaDateType2.Mon = ((short)(0)); shafaDateType2.Time = "00:00"; shafaDateType2.Year = ((short)(0)); shafaDateType2.YearFull = 0; this.bloodRegister_UI1.RegisterDate = shafaDateType2; this.bloodRegister_UI1.RightToLeft = System.Windows.Forms.RightToLeft.Yes; this.bloodRegister_UI1.Section = ((short)(0)); this.bloodRegister_UI1.Size = new System.Drawing.Size(640, 510); this.bloodRegister_UI1.TabIndex = 0; // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(684, 585); this.Controls.Add(this.bloodRegister_UI1); this.MinimumSize = new System.Drawing.Size(660, 500); this.Name = "Form1"; this.Text = "سامانه ثبت خون در بانک خون بیمارستان بقیه الله"; this.ResumeLayout(false); }
private void EditBloodToolStripMenuItem_Click(object sender, System.EventArgs e) { _IsNew = false; saveButton.Text = "ویرایش خون"; dateTimeBox.Enabled = false; this.BloodSerial = bloodListdataGridView.CurrentRow.Cells[0].Value.ToString(); this.BloodGroup = bloodListdataGridView.CurrentRow.Cells[1].Value.ToString(); this.Section = short.Parse(bloodListdataGridView.CurrentRow.Cells[2].Value.ToString()); this.EditDate = new ShafaCommon.Types.ShafaDateType(bloodListdataGridView.CurrentRow.Cells[0].Value.ToString()); this.BloodSerial = bloodListdataGridView.CurrentRow.Cells[0].Value.ToString(); }
public void SaveDataBlood(string bloodSerial, string bloodGroup, string section, ShafaCommon.Types.ShafaDateType registerDate, out string message) { message = string.Empty; DAL.Model.DatabaseContext databaseContext = null; try { databaseContext = new DAL.Model.DatabaseContext(); #region Validation if (string.IsNullOrWhiteSpace(bloodSerial)) { message = BloodBusinessLogicalLayer.Properties.Resources.validationBloodSerial; } if (string.IsNullOrWhiteSpace(bloodGroup)) { if (string.IsNullOrWhiteSpace(message) == false) { message += System.Environment.NewLine; } message += BloodBusinessLogicalLayer.Properties.Resources.validationBloodGroup; return; } if (string.IsNullOrWhiteSpace(section.ToString())) { if (string.IsNullOrWhiteSpace(message) == false) { message += System.Environment.NewLine; } message += BloodBusinessLogicalLayer.Properties.Resources.validationSection; return; } if (string.IsNullOrWhiteSpace(registerDate.ToString())) { if (string.IsNullOrWhiteSpace(message) == false) { message += System.Environment.NewLine; } message += BloodBusinessLogicalLayer.Properties.Resources.validationRegisterDate; } if (string.IsNullOrWhiteSpace(message) == false) { ShafaCommon.Common.MessageManager.ShowMessageBox (message); return; } #endregion /Validation DAL.Model.Blood blood = databaseContext.Bloods .Where(current => string.Compare(current.BloodSerial, bloodSerial) == 0) .FirstOrDefault(); if (blood != null) { ShafaCommon.Common.MessageManager.ShowMessageBox (BloodBusinessLogicalLayer.Properties.Resources.stringFoundBlood); return; } else { blood = new DAL.Model.Blood { BloodSerial = bloodSerial, BloodGorup = bloodGroup, Section = section, RegisterDate = registerDate.ToString(), EditDate = string.Empty, }; } databaseContext.Bloods.Add(blood); databaseContext.SaveChanges(); ShafaCommon.Common.MessageManager.ShowMessageBox (BloodBusinessLogicalLayer.Properties.Resources.stringSaveBlood); } catch (Exception ex) { ShafaCommon.Common.ExceptionManager.ManageException(ex); } }
public void EditDataBlood(string bloodSerial, string bloodGroup, string section, ShafaCommon.Types.ShafaDateType editDate, out string message) { message = string.Empty; DAL.Model.DatabaseContext databaseContext = null; try { databaseContext = new DAL.Model.DatabaseContext(); #region Validation if (string.IsNullOrWhiteSpace(bloodSerial)) { message = BloodBusinessLogicalLayer.Properties.Resources.validationBloodSerial; } if (string.IsNullOrWhiteSpace(message) == false) { ShafaCommon.Common.MessageManager.ShowMessageBox (message); return; } #endregion /Validation DAL.Model.Blood blood = databaseContext.Bloods .Where(current => string.Compare(current.BloodSerial, bloodSerial) == 0) .FirstOrDefault(); if (blood == null) { ShafaCommon.Common.MessageManager.ShowMessageBox (BloodBusinessLogicalLayer.Properties.Resources.stringNotFoundBlood); return; } else { blood.BloodSerial = bloodSerial; blood.BloodGorup = bloodGroup; blood.Section = section; blood.EditDate = editDate.ToString(); } databaseContext.SaveChanges(); ShafaCommon.Common.MessageManager.ShowMessageBox (BloodBusinessLogicalLayer.Properties.Resources.stringEditBlood); } catch (Exception ex) { ShafaCommon.Common.ExceptionManager.ManageException(ex); } }