Пример #1
0
        protected void lnkUpdateWTE_OnCommand(object sender, CommandEventArgs e)
        {
            //get details from formview hdnWteID
            WaterTreatmentEquipment w = new WaterTreatmentEquipment();

            w.WTE_ID       = Convert.ToInt32((fviewUpdateWTE.FindControl("hdnWteID") as HiddenField).Value.ToString());
            w.Description  = (fviewUpdateWTE.FindControl("txtDescription") as TextBox).Text;
            w.Manufacturer = (fviewUpdateWTE.FindControl("txtManufacturer") as TextBox).Text;
            w.ProductCode  = (fviewUpdateWTE.FindControl("txtProductCode") as TextBox).Text;
            w.DateObtained = Convert.ToDateTime((fviewUpdateWTE.FindControl("txtDateObtained") as TextBox).Text);
            w.ModifiedBy   = User.Identity.Name.ToString();



            //update the record
            WTEManager.Save(w);

            //re-display the gridview
            DisplayWTE();
        }
Пример #2
0
        protected void lnkAddWTE_OnCommand(object sender, CommandEventArgs e)
        {
            //add record to db

            //get date from form
            WaterTreatmentEquipment w = new WaterTreatmentEquipment();

            w.AccountID    = _accountID;
            w.ProductCode  = (fviewWTE.FindControl("txtProductCode") as TextBox).Text;
            w.Description  = (fviewWTE.FindControl("txtDescription") as TextBox).Text;
            w.Manufacturer = (fviewWTE.FindControl("txtManufacturer") as TextBox).Text;
            w.DateObtained = Convert.ToDateTime((fviewWTE.FindControl("txtDateObtained") as TextBox).Text);
            w.CreatedBy    = User.Identity.Name.ToString();
            w.WTE_ID       = WTEManager.Save(w);

            ClearWTEFields();

            //populate the gridview
            DisplayWTE();
        }