コード例 #1
0
 /* Op=1 Insert Data
  * Op=2 Update Data
  * Op=3 Delete Data
  * Op=4 Get Current Records
  * Op=5 Get Current Records By Site
  * Op=6 Notification for admin
  * Op=7 Notification for Supervisor*/
 public DataSet SiteMachineRecords(clsSiteMachineRecords obj)
 {
     try
     {
         connect();
         //ID, SiteID, SiteMachineID, RecordName, RecordValue, ValidFrom, ValidTo, TotalCost, RemindBeforeDays
         SqlParameter[] param = new SqlParameter[10];
         param[0] = new SqlParameter("@ID", obj._ID);
         param[1] = new SqlParameter("@SiteID", obj._SiteID);
         param[2] = new SqlParameter("@SiteMachineID", obj._SiteMachineID);
         param[3] = new SqlParameter("@RecordName", obj._RecordName);
         param[4] = new SqlParameter("@RecordValue", obj._RecordValue);
         param[5] = new SqlParameter("@ValidFrom", obj._ValidFrom);
         param[6] = new SqlParameter("@ValidTo", obj._ValidTo);
         param[7] = new SqlParameter("@TotalCost", obj._TotalCost);
         param[8] = new SqlParameter("@RemindBeforeDays", obj._RemindBeforeDays);
         param[9] = new SqlParameter("@Op", obj._Op);
         DataSet ds = SqlHelper.ExecuteDataset(co, "procSiteMachineRecords", param);
         return(ds);
     }
     catch
     {
         return(null);
     }
     finally
     {
         co.Close();
     }
 }
コード例 #2
0
    protected void grdRecords_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        clsSiteMachineRecords obj = new clsSiteMachineRecords();

        obj.Op = 3;
        obj.ID = Convert.ToInt32(grdRecords.DataKeys[e.RowIndex].Value);
        obj.SiteMachineRecords(obj);
        LoadData();
    }
コード例 #3
0
    void LoadData()
    {
        clsSiteMachineRecords obj = new clsSiteMachineRecords();

        obj.SiteID = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        obj.Op     = 5;
        DataTable dt = obj.SiteMachineRecords(obj).Tables[0];

        grdRecords.DataSource = dt;
        grdRecords.DataBind();
    }
コード例 #4
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        clsSiteMachineRecords obj = new clsSiteMachineRecords();

        obj.SiteID           = Convert.ToInt32(Request.Cookies["SiteID"].Value);
        obj.SiteMachineID    = Convert.ToInt32(ddlMachine.SelectedValue);
        obj.RecordName       = ddlRecordName.Text;
        obj.RecordValue      = txtRecordNo.Text;
        obj.ValidFrom        = txtValidFrom.Text;
        obj.ValidTo          = txtValidTo.Text;
        obj.TotalCost        = Convert.ToDouble(txtTotalCost.Text);
        obj.RemindBeforeDays = Convert.ToInt32(txtRemindBefore.Text);
        obj.Op = 1;
        obj.SiteMachineRecords(obj);
        pnlExisitng.Visible = true;
        pnlNew.Visible      = false;
        LoadData();
    }
コード例 #5
0
    protected void grdRecords_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        TextBox txtERecordName       = (TextBox)grdRecords.Rows[e.RowIndex].FindControl("txtERecordName");
        TextBox txtERecordValue      = (TextBox)grdRecords.Rows[e.RowIndex].FindControl("txtERecordValue");
        TextBox txtEValidFrom        = (TextBox)grdRecords.Rows[e.RowIndex].FindControl("txtEValidFrom");
        TextBox txtEValidTo          = (TextBox)grdRecords.Rows[e.RowIndex].FindControl("txtEValidTo");
        TextBox txtETotalCost        = (TextBox)grdRecords.Rows[e.RowIndex].FindControl("txtETotalCost");
        TextBox txtERemindBeforeDays = (TextBox)grdRecords.Rows[e.RowIndex].FindControl("txtERemindBeforeDays");
        clsSiteMachineRecords obj    = new clsSiteMachineRecords();

        obj.RecordName       = txtERecordName.Text;
        obj.RecordValue      = txtERecordValue.Text;
        obj.ValidFrom        = txtEValidFrom.Text;
        obj.ValidTo          = txtEValidTo.Text;
        obj.TotalCost        = Convert.ToDouble(txtETotalCost.Text);
        obj.RemindBeforeDays = Convert.ToInt32(txtERemindBeforeDays.Text);
        obj.ID = Convert.ToInt32(grdRecords.DataKeys[e.RowIndex].Value);
        obj.Op = 2;
        obj.SiteMachineRecords(obj);
        grdRecords.EditIndex = -1;
        LoadData();
    }