示例#1
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (_Beam == null)
            {
                lblMessage.Text = "Silinecek kirişi seçiniz.";
                return;
            }
            try
            {
                using (IBeamRepository beamRepo = new BeamRepository(new BeamDeflectionDbContext()))
                {
                    Beam oldBeam = beamRepo.Get(x => x.ID == _Beam.ID).Result;
                    var  result  = beamRepo.Delete(oldBeam);
                    switch (result.State)
                    {
                    case Basecore.Model.Enums.BusinessResultType.NotSet:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Success:
                        lblMessage.Text = "Başarıyla silindi. Son silinen kiriş tipi adı : " + oldBeam.Name;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Error:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Warning:
                        lblMessage.Text = result.Message;
                        break;

                    case Basecore.Model.Enums.BusinessResultType.Info:
                        lblMessage.Text = result.Message;
                        break;

                    default:
                        break;
                    }
                    ucEditBeams_Load(sender, e);
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Hata : " + ex.GetBaseException();
            }
        }
示例#2
0
        private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (_Beam == null)
            {
                lblMessage.Text = "Düzenlenecek kirişi seçiniz.";
                return;
            }
            using (IBeamRepository beamRepo = new BeamRepository(new BeamDeflectionDbContext()))
            {
                Beam beam = _Beam;
                beam.IsActive  = chkIsActive.Checked;
                beam.IsDeleted = chkIsDeleted.Checked;
                beam.Name      = txtBeamName.Text;
                beam.UpdatedAt = DateTime.UtcNow;

                var result = beamRepo.Update(beam);
                switch (result.State)
                {
                case Basecore.Model.Enums.BusinessResultType.NotSet:
                    lblMessage.Text = result.Message;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Success:
                    lblMessage.Text = "Güncelleme başarılı. Son güncellenen kirişin adı : " + result.Result.Name;

                    break;

                case Basecore.Model.Enums.BusinessResultType.Error:
                    lblMessage.Text = result.Message;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Warning:
                    lblMessage.Text = result.Message;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Info:
                    lblMessage.Text = result.Message;
                    break;

                default:
                    break;
                }
                ucEditBeams_Load(sender, e);
            }
        }
示例#3
0
 private void ucGetBeams_Load(object sender, EventArgs e)
 {
     using (IBeamRepository beamRepo = new BeamRepository(new BeamDeflectionDbContext()))
     {
         var result = beamRepo.GetList();
         if (result != null)
         {
             dgvBeams.DataSource                      = result.Result;
             dgvBeams.Columns["ID"].Visible           = false;
             dgvBeams.Columns["Loads"].Visible        = false;
             dgvBeams.Columns["Name"].HeaderText      = "Kiriş Tipi";
             dgvBeams.Columns["CreatedAt"].HeaderText = "Oluşturulma Tarihi";
             dgvBeams.Columns["UpdatedAt"].HeaderText = "Düzenlenme Tarihi";
             dgvBeams.Columns["IsDeleted"].HeaderText = "Silinme";
             dgvBeams.Columns["IsActive"].HeaderText  = "Aktiflik";
         }
     }
 }
示例#4
0
 private void ucEditBeams_Load(object sender, EventArgs e)
 {
     txtBeamName.Text = String.Empty;
     txtBeamName.Tag  = null;
     if (chkIsDeleted.Checked == true)
     {
         chkIsDeleted.Text = "Evet";
     }
     else
     {
         chkIsDeleted.Text = "Hayır";
     }
     if (chkIsActive.Checked == true)
     {
         chkIsActive.Text = "Evet";
     }
     else
     {
         chkIsActive.Text = "Hayır";
     }
     chkIsActive.Checked  = true;
     chkIsDeleted.Checked = false;
     try
     {
         using (IBeamRepository beamRepo = new BeamRepository(new BeamDeflectionDbContext()))
         {
             var result = beamRepo.GetList();
             if (result != null)
             {
                 dgvBeams.DataSource                      = result.Result;
                 dgvBeams.Columns["ID"].Visible           = false;
                 dgvBeams.Columns["Name"].HeaderText      = "Kiriş Tipi";
                 dgvBeams.Columns["CreatedAt"].HeaderText = "Oluşturulma Tarihi";
                 dgvBeams.Columns["UpdatedAt"].HeaderText = "Düzenlenme Tarihi";
                 dgvBeams.Columns["IsDeleted"].HeaderText = "Silinme";
                 dgvBeams.Columns["IsActive"].HeaderText  = "Aktiflik";
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
示例#5
0
        private void btnInsert_Click(object sender, EventArgs e)
        {
            if (txtBeamName.Text == String.Empty)
            {
                MessageBox.Show("Kiriş tipi adı boş geçilemez.");
                txtBeamName.Focus();
                return;
            }
            using (IBeamRepository beamRepo = new BeamRepository(new BeamDeflectionDbContext()))
            {
                var result = beamRepo.Insert(new Beam
                {
                    IsActive = chkIsActive.Checked,
                    Name     = txtBeamName.Text
                });
                switch (result.State)
                {
                case Basecore.Model.Enums.BusinessResultType.NotSet:
                    lblMessage.Text = result.Message;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Success:
                    lblMessage.Text     = "Kayıt başarılı.";
                    txtBeamName.Text    = String.Empty;
                    chkIsActive.Checked = true;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Error:
                    lblMessage.Text = result.Message;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Warning:
                    lblMessage.Text = result.Message;
                    break;

                case Basecore.Model.Enums.BusinessResultType.Info:
                    lblMessage.Text = result.Message;
                    break;

                default:
                    break;
                }
            }
        }
示例#6
0
        private void ucEditLoads_Load(object sender, EventArgs e)
        {
            chkIsActive.Text     = "Evet";
            chkIsActive.Checked  = true;
            chkIsDeleted.Text    = "Hayır";
            chkIsDeleted.Checked = false;
            try
            {
                using (ILoadRepository loadRepo = new LoadRepository(new Datacore.Data.BeamDeflectionDbContext()))
                {
                    var result = loadRepo.GetList("Beam");
                    if (result.Result == null)
                    {
                        return;
                    }
                    dgvLoads.DataSource = result.Result;
                    dgvLoads.Columns["BeamId"].Visible       = false;
                    dgvLoads.Columns["Calculations"].Visible = false;
                    dgvLoads.Columns["ID"].Visible           = false;

                    dgvLoads.Columns["Name"].HeaderText      = "Yük Adı";
                    dgvLoads.Columns["CreatedAt"].HeaderText = "Oluşturulma Tarihi";
                    dgvLoads.Columns["UpdatedAt"].HeaderText = "Düzenlenme Tarihi";
                    dgvLoads.Columns["IsDeleted"].HeaderText = "Silinme";
                    dgvLoads.Columns["IsActive"].HeaderText  = "Aktiflik";
                }
                using (IBeamRepository beamRepo = new BeamRepository(new Datacore.Data.BeamDeflectionDbContext()))
                {
                    var result = beamRepo.GetList("Loads");
                    if (result == null)
                    {
                        lblMessage.Text = "Kayıtlı kiriş tipi bulunamadı. Önce kiriş tipi ekleyin";
                        return;
                    }
                    cmbBeams.DataSource = result.Result;
                }
            }
            catch (Exception ex)
            {
                lblMessage.Text = "Hata : " + ex.GetBaseException();
            }
        }
 private void FrmCalculation_Load(object sender, EventArgs e)
 {
     try
     {
         using (IBeamRepository beamRepo = new BeamRepository(new Datacore.Data.BeamDeflectionDbContext()))
         {
             var result = beamRepo.GetList();
             if (result == null)
             {
                 return;
             }
             cmbBeams.DataSource    = result.Result;
             cmbBeams.DisplayMember = "Name";
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
 private void ucInsertLoad_Load(object sender, EventArgs e)
 {
     btnInsert.Enabled = true;
     try
     {
         using (IBeamRepository beamRepo = new BeamRepository(new Datacore.Data.BeamDeflectionDbContext()))
         {
             var result = beamRepo.GetList();
             if (result.Result == null)
             {
                 lblMessage.Text   = "Kayıtlı kiriş tipi bulunamadı. Önce kiriş tipi ekleyin.";
                 btnInsert.Enabled = false;
                 return;
             }
             cmbBeam.DataSource = result.Result;
         }
     }
     catch (Exception ex)
     {
         lblMessage.Text = "Hata : " + ex.GetBaseException();
     }
 }
示例#9
0
        public static void Starter()
        {
            using (BeamDeflectionDbContext ctx = new BeamDeflectionDbContext())
            {
                if (ctx.Users.SingleOrDefault(x => x.Username == "admin") != null)
                {
                    return;
                }
            }
            using (IUnitRepository unitRepo = new UnitRepository(new BeamDeflectionDbContext()))
            {
                try
                {
                    List <Unit> units = new List <Unit> {
                        new Unit {
                            Name    = "meters",
                            Display = "m"
                        },
                        new Unit {
                            Name    = "centimeters",
                            Display = "cm"
                        },
                        new Unit {
                            Name    = "milimeters",
                            Display = "mm"
                        },
                        new Unit {
                            Name    = "kilonewtons",
                            Display = "kN"
                        },
                        new Unit {
                            Name    = "newtons",
                            Display = "N"
                        },
                        new Unit {
                            Name    = "megapascals",
                            Display = "MPa"
                        },
                        new Unit {
                            Name    = "pascals",
                            Display = "Pa"
                        },
                        new Unit {
                            Name    = "meters to fourth power",
                            Display = "m⁴"
                        },
                        new Unit {
                            Name    = "centimeters to fourth power",
                            Display = "cm⁴"
                        },
                        new Unit {
                            Name    = "newtons per meter",
                            Display = "N/m"
                        },
                        new Unit {
                            Name    = "kilonewtons per meter",
                            Display = "kN/m"
                        },
                        new Unit {
                            Name    = "newton meters",
                            Display = "Nm"
                        },
                        new Unit {
                            Name    = "kilogram-centimeters",
                            Display = "kg-cm"
                        }
                    };
                    unitRepo.InsertList(units);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            using (IBeamRepository beamRepo = new BeamRepository(new BeamDeflectionDbContext()))
            {
                try
                {
                    List <Beam> beams = new List <Beam>
                    {
                        new Beam
                        {
                            Name = "Basitçe desteklenen kiriş"
                        },
                        new Beam
                        {
                            Name = "Konsol kiriş"
                        }
                    };
                    beamRepo.InsertList(beams);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            using (IRoleRepository roleRepo = new RoleRepository(new BeamDeflectionDbContext()))
            {
                try
                {
                    List <Role> roles = new List <Role>
                    {
                        new Role
                        {
                            Name = "admin"
                        },
                        new Role
                        {
                            Name = "appuser"
                        },
                        new Role
                        {
                            Name = "guest"
                        }
                    };
                    roleRepo.InsertList(roles);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            using (IUserRepository userRepo = new UserRepository(new BeamDeflectionDbContext()))
            {
                try
                {
                    userRepo.Register("admin", "admin", "admin", "admin", "admin", "admin", true);
                    userRepo.Register("Yeliz", "yeliz", "student", "Yeliz", "ERDOĞAN", "admin", true);
                    userRepo.Register("user", "user", "appuser", "Yeliz", "ERDOĞAN", "appuser", true);
                }
                catch (Exception)
                {
                    throw;
                }
            }
            using (ILoadRepository loadRepo = new LoadRepository(new BeamDeflectionDbContext()))
            {
                try
                {
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Ortadan yük"
                    }, "Basitçe desteklenen kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Herhangi bir noktadan yük"
                    }, "Basitçe desteklenen kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Düzgün yük"
                    }, "Basitçe desteklenen kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Düzgün değişen yük"
                    }, "Basitçe desteklenen kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Üçgen yük"
                    }, "Basitçe desteklenen kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Tek destekte moment yükü"
                    }, "Basitçe desteklenen kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Sona yük"
                    }, "Konsol Kiriş");


                    loadRepo.InsertWithBeam(new Load {
                        Name = "Herhangi bir noktaya yük"
                    }, "Konsol kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Düzgün yayılan yük"
                    }, "Konsol kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Düzgün değişen yük (Durum 1)"
                    }, "Konsol kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Düzgün değişen yük (Durum 2)"
                    }, "Konsol kiriş");
                    loadRepo.InsertWithBeam(new Load {
                        Name = "Sonunda moment yükü"
                    }, "Konsol kiriş");
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }