Exemplo n.º 1
0
 public static STD_Batch GetSTD_BatchMaxIDByYear(int year)
 {
     STD_Batch sTD_Batch = new STD_Batch();
     SqlSTD_BatchProvider sqlSTD_BatchProvider = new SqlSTD_BatchProvider();
     sTD_Batch = sqlSTD_BatchProvider.GetSTD_BatchMaxIDByYear(year);
     return sTD_Batch;
 }
Exemplo n.º 2
0
 public static STD_Batch GetSTD_BatchByBatchID(int BatchID)
 {
     STD_Batch sTD_Batch = new STD_Batch();
     SqlSTD_BatchProvider sqlSTD_BatchProvider = new SqlSTD_BatchProvider();
     sTD_Batch = sqlSTD_BatchProvider.GetSTD_BatchByBatchID(BatchID);
     return sTD_Batch;
 }
Exemplo n.º 3
0
 public static STD_Batch GetCOMN_RowStatusByRowStatusID(int RowStatusID)
 {
     STD_Batch sTD_Batch = new STD_Batch();
     SqlSTD_BatchProvider sqlSTD_BatchProvider = new SqlSTD_BatchProvider();
     sTD_Batch = sqlSTD_BatchProvider.GetSTD_BatchByRowStatusID(RowStatusID);
     return sTD_Batch;
 }
Exemplo n.º 4
0
 protected void btnUpdate_Click(object sender, EventArgs e)
 {
     STD_Batch sTD_Batch = new STD_Batch ();
     sTD_Batch.BatchID=  int.Parse(Request.QueryString["ID"].ToString());
     sTD_Batch.BatchName=  txtBatchName.Text;
     sTD_Batch.Year=  int.Parse(txtYear.Text);
     sTD_Batch.ID=  int.Parse(ddlID.SelectedValue);
     sTD_Batch.BatchCode=  txtBatchCode.Text;
     sTD_Batch.ExtraField1=  txtExtraField1.Text;
     sTD_Batch.ExtraField2=  txtExtraField2.Text;
     sTD_Batch.ExtraField3=  txtExtraField3.Text;
     sTD_Batch.ExtraField4=  txtExtraField4.Text;
     sTD_Batch.ExtraField5=  txtExtraField5.Text;
     sTD_Batch.AddedBy=  "530038e1-cf38-4ddb-84a4-99b6974b4f9d";
     sTD_Batch.AddedDate=  DateTime.Now;
     sTD_Batch.UpdatedBy=  "530038e1-cf38-4ddb-84a4-99b6974b4f9d";
     sTD_Batch.UpdateDate=  DateTime.Now;
     sTD_Batch.RowStatusID=  int.Parse(ddlRowStatusID.SelectedValue);
     bool  resutl =STD_BatchManager.UpdateSTD_Batch(sTD_Batch);
     Response.Redirect("AdminDisplaySTD_Batch.aspx");
 }
Exemplo n.º 5
0
    public bool UpdateSTD_Batch(STD_Batch sTD_Batch)
    {
        using (SqlConnection connection = new SqlConnection(this.ConnectionString))
        {
            SqlCommand cmd = new SqlCommand("UpdateSTD_Batch", connection);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@BatchID", SqlDbType.Int).Value = sTD_Batch.BatchID;
            cmd.Parameters.Add("@BatchName", SqlDbType.NVarChar).Value = sTD_Batch.BatchName;
            cmd.Parameters.Add("@Year", SqlDbType.Int).Value = sTD_Batch.Year;
            cmd.Parameters.Add("@ID", SqlDbType.Int).Value = sTD_Batch.ID;
            cmd.Parameters.Add("@BatchCode", SqlDbType.NVarChar).Value = sTD_Batch.BatchCode;

            cmd.Parameters.Add("@ExtraField1", SqlDbType.NVarChar).Value = sTD_Batch.ExtraField1;
            cmd.Parameters.Add("@ExtraField2", SqlDbType.NVarChar).Value = sTD_Batch.ExtraField2;
            cmd.Parameters.Add("@ExtraField3", SqlDbType.NVarChar).Value = sTD_Batch.ExtraField3;
            cmd.Parameters.Add("@ExtraField4", SqlDbType.NVarChar).Value = sTD_Batch.ExtraField4;
            cmd.Parameters.Add("@ExtraField5", SqlDbType.NVarChar).Value = sTD_Batch.ExtraField5;

            cmd.Parameters.Add("@AddedBy", SqlDbType.NVarChar).Value = sTD_Batch.AddedBy;
            cmd.Parameters.Add("@AddedDate", SqlDbType.DateTime).Value = sTD_Batch.AddedDate;
            cmd.Parameters.Add("@UpdatedBy", SqlDbType.NVarChar).Value = sTD_Batch.UpdatedBy;
            cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value = sTD_Batch.UpdateDate;
            cmd.Parameters.Add("@RowStatusID", SqlDbType.Int).Value = sTD_Batch.RowStatusID;
            connection.Open();

            int result = cmd.ExecuteNonQuery();
            return result == 1;
        }
    }
Exemplo n.º 6
0
    public STD_Batch GetSTD_BatchFromReader1(IDataReader reader)
    {
        try
        {
            STD_Batch sTD_Batch = new STD_Batch
                (

                     DataAccessObject.IsNULL<int>(reader["MaxID"])
                );

            return sTD_Batch;
        }
        catch (Exception ex)
        {
            return null;
        }
    }
Exemplo n.º 7
0
    public STD_Batch GetSTD_BatchFromReader(IDataReader reader)
    {
        try
        {
            STD_Batch sTD_Batch = new STD_Batch
                (

                     DataAccessObject.IsNULL<int>(reader["BatchID"]),
                     DataAccessObject.IsNULL<string>(reader["BatchName"]),

                     DataAccessObject.IsNULL<int>(reader["Year"]),
                     DataAccessObject.IsNULL<int>(reader["ID"]),
                     DataAccessObject.IsNULL<string>(reader["BatchCode"]),

                     DataAccessObject.IsNULL<string>(reader["ExtraField1"]),
                     DataAccessObject.IsNULL<string>(reader["ExtraField2"]),
                     DataAccessObject.IsNULL<string>(reader["ExtraField3"]),
                     DataAccessObject.IsNULL<string>(reader["ExtraField4"]),
                     DataAccessObject.IsNULL<string>(reader["ExtraField5"]),

                      DataAccessObject.IsNULL<string>(reader["AddedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["AddedDate"]),
                     DataAccessObject.IsNULL<string>(reader["UpdatedBy"].ToString()),
                     DataAccessObject.IsNULL<DateTime>(reader["UpdateDate"]),
                     DataAccessObject.IsNULL<int>(reader["RowStatusID"])
                );
             return sTD_Batch;
        }
        catch(Exception ex)
        {
            return null;
        }
    }
Exemplo n.º 8
0
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        DateTime date = DateTime.Now;
        int year = 0;
        year = date.Year;

        DataSet batch = STD_BatchManager.GetAllSTD_BatchMaxIDByYearnID(year,int.Parse(txtBatchName.Text));
        if (batch.Tables[0].Rows.Count != 0)
        {
            lblMessage.Text = "Already in Database.";
        }
        else
        {
            STD_Batch sTD_Batch = new STD_Batch();

            sTD_Batch.BatchName = "Batch - "+txtBatchName.Text;

            sTD_Batch.BatchCode = year.ToString().Substring(2, 2) + int.Parse(txtBatchName.Text).ToString("000");
            sTD_Batch.ID = int.Parse(txtBatchName.Text);
            sTD_Batch.Year = year;

            sTD_Batch.ExtraField1 = " ";
            sTD_Batch.ExtraField2 = " ";
            sTD_Batch.ExtraField3 = " ";
            sTD_Batch.ExtraField4 = " ";
            sTD_Batch.ExtraField5 = " ";

            sTD_Batch.AddedBy = Profile.card_id;
            sTD_Batch.AddedDate = DateTime.Now;
            sTD_Batch.UpdatedBy = Profile.card_id;
            sTD_Batch.UpdateDate = DateTime.Now;

            sTD_Batch.RowStatusID = 1;
            int resutl = STD_BatchManager.InsertSTD_Batch(sTD_Batch);
            Response.Redirect("AdminDisplaySTD_Batch.aspx");
        }

        //STD_Batch batch = STD_BatchManager.GetSTD_BatchMaxIDByYear(year);
        //if (batch.MaxID != 0)
        //{

        //    STD_Batch sTD_Batch = new STD_Batch();

        //    sTD_Batch.BatchName = txtBatchName.Text;

        //    sTD_Batch.BatchCode = year.ToString().Substring(2, 2) + batch.MaxID.ToString("000");
        //    sTD_Batch.ID = batch.MaxID;
        //    sTD_Batch.Year = year;

        //    sTD_Batch.ExtraField1 = " ";
        //    sTD_Batch.ExtraField2 = " ";
        //    sTD_Batch.ExtraField3 = " ";
        //    sTD_Batch.ExtraField4 = " ";
        //    sTD_Batch.ExtraField5 = " ";

        //    sTD_Batch.AddedBy = Profile.card_id;
        //    sTD_Batch.AddedDate = DateTime.Now;
        //    sTD_Batch.UpdatedBy = Profile.card_id;
        //    sTD_Batch.UpdateDate = DateTime.Now;

        //    sTD_Batch.RowStatusID = int.Parse(ddlRowStatusID.SelectedValue);
        //    int resutl = STD_BatchManager.InsertSTD_Batch(sTD_Batch);
        //    Response.Redirect("AdminDisplaySTD_Batch.aspx");
        //}
        //else
        //{
        //    STD_Batch sTD_Batch = new STD_Batch();
        //    //	sTD_Batch.BatchID=  int.Parse(ddlBatchID.SelectedValue);
        //    sTD_Batch.BatchName = txtBatchName.Text;
        //    sTD_Batch.BatchCode = year.ToString().Substring(2, 2) + "001";
        //    sTD_Batch.ID = 1;
        //    sTD_Batch.Year = year;

        //    sTD_Batch.ExtraField1 = " ";
        //    sTD_Batch.ExtraField2 = " ";
        //    sTD_Batch.ExtraField3 = " ";
        //    sTD_Batch.ExtraField4 = " ";
        //    sTD_Batch.ExtraField5 = " ";

        //    sTD_Batch.AddedBy = Profile.card_id;
        //    sTD_Batch.AddedDate = DateTime.Now;
        //    sTD_Batch.UpdatedBy = Profile.card_id;
        //    sTD_Batch.UpdateDate = DateTime.Now;
        //    sTD_Batch.RowStatusID = int.Parse(ddlRowStatusID.SelectedValue);
        //    int resutl = STD_BatchManager.InsertSTD_Batch(sTD_Batch);
        //    Response.Redirect("AdminDisplaySTD_Batch.aspx");
        //}
    }
Exemplo n.º 9
0
 private void showSTD_BatchData()
 {
     STD_Batch sTD_Batch  = new STD_Batch ();
      	sTD_Batch = STD_BatchManager.GetSTD_BatchByBatchID(Int32.Parse(Request.QueryString["ID"]));
      	txtBatchName.Text =sTD_Batch.ID.ToString();
      	//ddlRowStatusID.SelectedValue  =sTD_Batch.RowStatusID.ToString();
 }
Exemplo n.º 10
0
 private void showSTD_BatchData()
 {
     STD_Batch sTD_Batch  = new STD_Batch ();
      	sTD_Batch = STD_BatchManager.GetSTD_BatchByBatchID(Int32.Parse(Request.QueryString["ID"]));
      	txtBatchName.Text =sTD_Batch.BatchName.ToString();
      	txtYear.Text =sTD_Batch.Year.ToString();
      	ddlID.SelectedValue  =sTD_Batch.ID.ToString();
      	txtBatchCode.Text =sTD_Batch.BatchCode.ToString();
      	txtExtraField1.Text =sTD_Batch.ExtraField1.ToString();
      	txtExtraField2.Text =sTD_Batch.ExtraField2.ToString();
      	txtExtraField3.Text =sTD_Batch.ExtraField3.ToString();
      	txtExtraField4.Text =sTD_Batch.ExtraField4.ToString();
      	txtExtraField5.Text =sTD_Batch.ExtraField5.ToString();
      	ddlRowStatusID.SelectedValue  =sTD_Batch.RowStatusID.ToString();
 }
Exemplo n.º 11
0
 public static int InsertSTD_Batch(STD_Batch sTD_Batch)
 {
     SqlSTD_BatchProvider sqlSTD_BatchProvider = new SqlSTD_BatchProvider();
     return sqlSTD_BatchProvider.InsertSTD_Batch(sTD_Batch);
 }
Exemplo n.º 12
0
 public static bool UpdateSTD_Batch(STD_Batch sTD_Batch)
 {
     SqlSTD_BatchProvider sqlSTD_BatchProvider = new SqlSTD_BatchProvider();
     return sqlSTD_BatchProvider.UpdateSTD_Batch(sTD_Batch);
 }