protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                BtnAddRecord.Enabled = false;
                HatcheryEntities db = new HatcheryEntities();
                WaterParameterPostLarva newWaterParameter = new WaterParameterPostLarva();
                newWaterParameter.ModuleName = ModuleDropDownList.SelectedValue;
                newWaterParameter.ProductionCycleID = Convert.ToInt32(ProductionCycleIDDDL.SelectedValue);
                newWaterParameter.Date = WaterParameterDatePicker.SelectedDate;
                newWaterParameter.Alkalinty = Convert.ToDouble(TxtAlkalinty.Text);
                newWaterParameter.Temperature = Convert.ToDouble(TxtTemperature.Text);
                newWaterParameter.PH = Convert.ToDouble(TxtPh.Text);
                newWaterParameter.NH3 = Convert.ToDouble(TxtNh3.Text);
                newWaterParameter.N = Convert.ToDouble(NTxt.Text);
                newWaterParameter.Salinity = Convert.ToDouble(TxtSalinity.Text);
                newWaterParameter.DO = Convert.ToDouble(TxtDo.Text);
                newWaterParameter.Remark = TxtRemark.Text;
                newWaterParameter.Algae = AlgaeTXT.Text;
                newWaterParameter.userID = TxtUserID.Text;

                db.WaterParameterPostLarvas.Add(newWaterParameter);
                db.SaveChanges();

                BtnAddRecord.Enabled = true;

            }
        }
Пример #2
0
        protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                HatcheryEntities db = new HatcheryEntities();

                Harvest newHarvest = new Harvest();
                newHarvest.ProductionCycleID = Convert.ToInt32( ProductionCycleDDl.SelectedValue);
                newHarvest.DOC = Convert.ToInt32(TxtDoc.Text);
                newHarvest.Stage = StagesDDL.SelectedValue;
                newHarvest.HarvestedPopulation = Convert.ToInt32( TxtHarvestedPopulation.Text);
                newHarvest.Date = Convert.ToDateTime(TxtDate.Text);
                newHarvest.Time = TimeSpan.Parse(TxtTime.Text);
                newHarvest.userid = TxtUserid.Text;

                db.Harvests.Add(newHarvest);
                db.SaveChanges();

                var ProdCycleQuery = from ProdCycle in db.ProductionCycles where ProdCycle.ProductionCycleID == newHarvest.ProductionCycleID select ProdCycle;
                ProductionCycle selectedCycle = ProdCycleQuery.Single();

                selectedCycle.isInProduction = false;

                db.SaveChanges();
            }
        }
Пример #3
0
        protected void BtnAddRecord_Click(object sender, EventArgs e)
        {
            //todo insert to database
            Page.Validate();
            if (Page.IsValid)
            {
                try
                {
                    HatcheryEntities db = new HatcheryEntities();
                    DailyMonitoringPostLarva newMonitor = new DailyMonitoringPostLarva();
                    newMonitor.ModuleName = DdlModuleName.SelectedValue;
                    newMonitor.ProductionCycleID = Convert.ToInt32(DdlProductionCycleID.SelectedValue);
                    newMonitor.Date = DatePicker.SelectedDate;
                    newMonitor.DOC = Convert.ToInt32(TxtDoc.Text);
                    newMonitor.Stage = StageDDL.SelectedValue;
                    newMonitor.Population = Convert.ToInt32(TxtPopulation.Text);
                    newMonitor.BiosZ = Convert.ToDouble(TxtBiosZ.Text);
                    newMonitor.BiosM = Convert.ToDouble(TxtBiosM.Text);
                    newMonitor.Bios100 = Convert.ToDouble(TxtBios100.Text);
                    newMonitor.Bios150 = Convert.ToDouble(TxtBios150.Text);
                    newMonitor.LanzyPL = Convert.ToDouble(TxtLanzyPL.Text);
                    newMonitor.LanzyMPL = Convert.ToDouble(TxtLanzyMPL.Text);
                    newMonitor.LanzyZM = Convert.ToDouble(TxtLanzyZM.Text);
                    newMonitor.MPZ = Convert.ToDouble(TxtMpz.Text);
                    newMonitor.MP1 = Convert.ToDouble(TxtMp1.Text);
                    newMonitor.MP2 = Convert.ToDouble(TxtMp2.Text);
                    newMonitor.MP3 = Convert.ToDouble(TxtMp3.Text);
                    newMonitor.MPL = Convert.ToDouble(TxtMpl.Text);
                    newMonitor.Spirulina = Convert.ToDouble(TxtSpirulina.Text);
                    newMonitor.LHF = Convert.ToDouble(TxtLhf.Text);
                    newMonitor.RoySF100_200 = Convert.ToDouble(TxtRoySF100_200.Text);
                    newMonitor.RoySF200_300 = Convert.ToDouble(TxtRoySF200_300.Text);
                    newMonitor.TzuFeng = Convert.ToDouble(TxtTzuFeng.Text);
                    newMonitor.Artemia = Convert.ToDouble(TxtArtemia.Text);
                    newMonitor.ArtemiaEZ1 = Convert.ToDouble(TxtArtemiaEZ1.Text);
                    newMonitor.ArtemiaEZ2 = Convert.ToDouble(TxtArtemiaEZ2.Text);
                    newMonitor.Activity = Convert.ToDouble(TxtActivity.Text);
                    newMonitor.Length = Convert.ToDouble(TxtLength.Text);
                    newMonitor.STDEV = Convert.ToDouble(TxtStdev.Text);
                    newMonitor.FGC = Convert.ToDouble(TxtFgc.Text);
                    newMonitor.Necrosis = Convert.ToDouble(TxtNecrosis.Text);
                    newMonitor.Fouling = Convert.ToDouble(TxtFouling.Text);
                    newMonitor.Parasite = Convert.ToDouble(TxtParasite.Text);
                    newMonitor.MGR = Convert.ToDouble(TxtMgr.Text);
                    newMonitor.Treflan = Convert.ToDouble(TxtTreflan.Text);
                    newMonitor.Probiotik = Convert.ToDouble(TxtProbiotik.Text);
                    newMonitor.Remark = TxtRemark.Text;
                    newMonitor.userID = TxtUserID.Text;

                    db.DailyMonitoringPostLarvas.Add(newMonitor);
                    db.SaveChanges();
                }
                catch (Exception)
                {
                }

            }
        }
        protected void SubmitButton_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
               // string cs = ConfigurationManager.ConnectionStrings["HatcheryConnectionString"].ConnectionString;

               // System.Data.SqlClient.SqlConnection sqlConnection1 = new System.Data.SqlClient.SqlConnection(cs);

               // //string selecteddate = BroodstockLogDateDatePicker.SelectedDate.ToString().Substring(0, 10);

               // System.Data.SqlClient.SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
               // cmd.CommandType = System.Data.CommandType.Text;
               // cmd.CommandText = "INSERT INTO [BroodStockMonitoring] ([Batch], [Date], [Male], [Female], [DeadMale], [DeadFemale], [Salinity], [MatTemp], [HatcTemp], [DO], [PH], [PolychaeteIn], [PolychaeteUsed], [PolychaeteBalance], [SquidIn], [SquidUsed], [SquidiBalance], [FR], [EDTA], [Formaldehyde], [Treflan], [Iodine], [Vitamin], [Matured], [Mated], [Spawned], [Egg], [NaupliiBruto], [NaupliiNetto], [Flush], [Distribution], [Remark], [userID]) VALUES  (" + BatchDropDownList.Text + ", '" +  BroodstockLogDateDatePicker.SelectedDate.ToString().Substring(0,10) + "', '" + MaleTextBox.Text + "', '" + FemaleTextBox.Text + "', '" + DeadMaleTextBox.Text + "', '" + DeadFemaleTextbox.Text + "', '" + SalinityTextBox.Text + "', '" + MaturationTempTextBox.Text + "', '" + HatchingTempTextbox.Text + "', '" + DOTextBOx.Text + "', '" + PHTextBox.Text + "', '" + PolycheateINTextBox.Text + "', '" + PolycheateUsedTextbox.Text + "', '" + PolycheateBalanceTextbox.Text + "', '" + SquidInTextBox.Text + "', '" + squidUsedTextBox.Text + "', '" + SquidBalanceTextbox.Text + "', '" + FRTextBox.Text + "', '" + EDTATextBox.Text + "', '" + FormalDehydeTextbox.Text + "', '" + treflantexbox.Text + "', '" + IodineTextBox.Text + "', '" + VitaminTextbox.Text + "', '" + MaturationTempTextBox.Text + "', '" + matedTextbox.Text + "', '" + SpawnTextbox.Text + "', '" + eggTextbox.Text + "', '" + NaupliiTextbox.Text + "', '" + NaupliiTextbox.Text + "', '" + FlushTextbox.Text + "', '" + DistributionTextbox.Text + "', '" + RemarkTextBOx.Text + "', '" + UserIDLabel.Text + "')";
               //// cmd.CommandText = "INSERT INTO [BroodStockMonitoring] ([Batch], [Date], [Male]) VALUES  (" + BatchDropDownList.Text + ", '" + BroodstockLogDateDatePicker.SelectedDate.ToString().Substring(0, 10) + "', '"+MaleTextBox.Text+"' )";
               // outputLabel.Text = cmd.CommandText.ToString();
               // cmd.Connection = sqlConnection1;

               // sqlConnection1.Open();
               // cmd.ExecuteNonQuery();
               // sqlConnection1.Close();
                try
                {
                    HatcheryEntities db = new HatcheryEntities();

                    BroodStockMonitoring newBroodStockMonitor = new BroodStockMonitoring();

                    newBroodStockMonitor.Batch = Convert.ToInt32(BatchDropDownList.SelectedValue);
                    newBroodStockMonitor.Date = BroodstockLogDateDatePicker.SelectedDate;
                    newBroodStockMonitor.Male = Convert.ToInt32(MaleTextBox.Text);
                    newBroodStockMonitor.DeadMale = Convert.ToInt32(DeadMaleTextBox.Text);
                    newBroodStockMonitor.Female = Convert.ToInt32(FemaleTextBox.Text);
                    newBroodStockMonitor.DeadFemale = Convert.ToInt32(DeadFemaleTextbox.Text);
                    newBroodStockMonitor.Salinity = Convert.ToDouble(SalinityTextBox.Text);
                    newBroodStockMonitor.MatTemp = Convert.ToDouble(MaturationTempTextBox.Text);
                    newBroodStockMonitor.HatcTemp = Convert.ToDouble(HatchingTempTextbox.Text);
                    newBroodStockMonitor.DO = Convert.ToDouble(DOTextBOx.Text);
                    newBroodStockMonitor.PH = Convert.ToDouble(PHTextBox.Text);
                    newBroodStockMonitor.PolychaeteIn = Convert.ToDouble(PolycheateINTextBox.Text);
                    newBroodStockMonitor.PolychaeteUsed = Convert.ToDouble(PolycheateUsedTextbox.Text);
                    newBroodStockMonitor.PolychaeteBalance = Convert.ToDouble(PolycheateBalanceTextbox.Text);
                    newBroodStockMonitor.SquidIn = Convert.ToDouble(SquidInTextBox.Text);
                    newBroodStockMonitor.SquidUsed = Convert.ToDouble(squidUsedTextBox.Text);
                    newBroodStockMonitor.SquidiBalance = Convert.ToDouble(SquidBalanceTextbox.Text);
                    newBroodStockMonitor.FR = Convert.ToDouble(FRTextBox.Text);
                    newBroodStockMonitor.EDTA = Convert.ToDouble(EDTATextBox.Text);
                    newBroodStockMonitor.Iodine = Convert.ToDouble(IodineTextBox.Text);
                    newBroodStockMonitor.Treflan = Convert.ToDouble(treflantexbox.Text);
                    newBroodStockMonitor.Formaldehyde = Convert.ToDouble(FormalDehydeTextbox.Text);
                    newBroodStockMonitor.Vitamin = Convert.ToDouble(VitaminTextbox.Text);
                    newBroodStockMonitor.Matured = Convert.ToInt32(maturedTextBox.Text);
                    newBroodStockMonitor.Mated = Convert.ToInt32(matedTextbox.Text);
                    newBroodStockMonitor.Spawned = Convert.ToInt32(SpawnTextbox.Text);
                    newBroodStockMonitor.Egg = Convert.ToDouble(eggTextbox.Text);
                    newBroodStockMonitor.NaupliiBruto = Convert.ToDouble(NaupliiTextbox.Text);
                    newBroodStockMonitor.NaupliiNetto = Convert.ToDouble(naupliiNettoTextBox.Text);
                    newBroodStockMonitor.Flush = Convert.ToDouble(FlushTextbox.Text);
                    newBroodStockMonitor.Distribution = DistributionTextbox.Text;
                    newBroodStockMonitor.Remark = RemarkTextBOx.Text;
                    newBroodStockMonitor.userID = UserIDLabel.Text;

                    db.BroodStockMonitorings.Add(newBroodStockMonitor);
                    db.SaveChanges();
                }
                catch (Exception g)
                {
                    errorLabel.Text = g.Message.ToString();
                }

            }
        }
Пример #5
0
        protected void DdlModuleName_SelectedIndexChanged(object sender, EventArgs e)
        {
            //  calculateDOC();
            HatcheryEntities db = new HatcheryEntities();

            var productionCycleQuery = from ProdCycle in db.ProductionCycles where ProdCycle.ModuleName == DdlModuleName.SelectedValue && ProdCycle.isInProduction == true select ProdCycle;

            List<ProductionCycle> ProductionCycleList = productionCycleQuery.ToList();

            DdlProductionCycleID.DataSource = ProductionCycleList;
            DdlProductionCycleID.DataValueField = "ProductionCycleID";
            DdlProductionCycleID.DataTextField = "ProductionCycleID";
            DdlProductionCycleID.DataBind();

            StartDateDDL.DataSource = ProductionCycleList;
            StartDateDDL.DataValueField = "StartDate";
            StartDateDDL.DataTextField = "StartDate";
            StartDateDDL.DataBind();

            if (productionCycleQuery.Count() <1)
            {
                var Errors = new CustomValidator();
                Errors.ValidationGroup = "No Production Cycle";
                Errors.IsValid = false;
                Errors.ErrorMessage = "No Production Cycle Found!";
                Page.Validators.Add(Errors);
            }
        }