Ejemplo n.º 1
0
 void FillDataForUpdate(MFMPoints data)
 {
     txtMeterName.Text          = data.MeterName;
     txtPointGas.Text           = data.PointGas.ToString();
     txtPointOil.Text           = data.PointOil.ToString();
     txtMeasurementSection.Text = data.MeasurementSection;
 }
Ejemplo n.º 2
0
 void Initialize()
 {
     if (Request.QueryString["Id"] != null && !string.IsNullOrEmpty(Request.QueryString["Id"].ToString()))
     {
         Update = true;
         Id     = StringHelper.TryParse(StringHelper.Decrypt(Request.QueryString["Id"].ToString()));
         MFMPoints points = SourceConnection.MFMPoints.Where(x => x.MFMPointsID.Equals(Id)).FirstOrDefault();
         FillDataForUpdate(points);
     }
 }
Ejemplo n.º 3
0
        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Id = (Update) ? StringHelper.TryParse(StringHelper.Decrypt(Request.QueryString["Id"].ToString())) : 0;
            MFMPoints data = (!Update) ? new MFMPoints() : SourceConnection.MFMPoints.Where(x => x.MFMPointsID.Equals(Id)).First();

            data.PointGas           = Convert.ToInt32(txtPointGas.Text);
            data.PointOil           = Convert.ToInt32(txtPointOil.Text);
            data.MeasurementSection = txtMeasurementSection.Text;
            data.MeterName          = txtMeterName.Text;

            if (!Update)
            {
                SourceConnection.MFMPoints.AddObject(data);
            }

            SourceConnection.SaveChanges();
            Response.Redirect("DataView.aspx");
        }
Ejemplo n.º 4
0
        protected void gvMFMPoints_RowCommand(object sender, GridCommandEventArgs e)
        {
            int dataId;

            switch (e.CommandName)
            {
            case "DeletePoint":
                dataId = Convert.ToInt32(e.CommandArgument);
                MFMPoints data = SourceConnection.MFMPoints.Where(x => x.MFMPointsID.Equals(dataId)).First();
                if (data != null)
                {
                    SourceConnection.MFMPoints.DeleteObject(data);
                    SourceConnection.SaveChanges();
                }
                BindPointsData();
                break;

            case "EditPoint":
                dataId = Convert.ToInt32(e.CommandArgument);
                Response.Redirect("AddorEdit.aspx?Id=" + StringHelper.Encrypt(dataId.ToString()));
                break;
            }
        }