Beispiel #1
0
        protected void saveButton_Click(object sender, EventArgs e)
        {
            BinderOrder binderOrder = new BinderOrder();

            binderOrder.Date     = dateTextBox.Value;
            binderOrder.Year     = yearTextBox.Text;
            binderOrder.OrderNo  = orderNoTextBox.Text;
            binderOrder.BinderId = int.Parse(binderNameDropDownList.SelectedValue);
            binderOrder.GroupId  = int.Parse(groupCodeDropDownList.SelectedValue);
            binderOrder.BookId   = int.Parse(bookCodeDropDownList.SelectedValue);
            string quantity      = quantityTextBox.Text;
            string formaQuantity = formaQuantityTextBox.Text;

            binderOrder.PressId = int.Parse(pressNameDropDownList.SelectedValue);
            string forma = formaTextBox.Text;

            if (dateTextBox.Value == "" || yearTextBox.Text == "" || orderNoTextBox.Text == "" ||
                quantityTextBox.Text == "" || formaQuantityTextBox.Text == "" || formaTextBox.Text == "")
            {
                messageLabel.InnerText = "All Fields are Required!!";
            }
            else
            {
                binderOrder.Quantity      = Convert.ToDouble(quantity);
                binderOrder.FormaQuantity = Convert.ToDouble(formaQuantity);
                binderOrder.Forma         = Convert.ToDouble(forma);
                messageLabel.InnerText    = binderOrderManager.Save(binderOrder);
            }
            ClearTextBoxes();
        }
Beispiel #2
0
        protected void firstButton_Click(object sender, EventArgs e)
        {
            BinderOrder binderOrder = binderOrderManager.GetBinderOrder(0);

            GetData(binderOrder);
            Session["active"] = 0;
        }
Beispiel #3
0
 public string Save(BinderOrder binderOrder)
 {
     if (binderOrderGateway.Insert(binderOrder) > 0)
     {
         return("Saved Successfully!!");
     }
     return("Could Not Save data in Database!!");
 }
Beispiel #4
0
        protected void lastButton_Click(object sender, EventArgs e)
        {
            List <BinderOrder> binderOrderList = (List <BinderOrder>)(Session["binderOrder"]);
            int         x           = binderOrderList.Count - 1;
            BinderOrder binderOrder = binderOrderManager.GetBinderOrder(x);

            GetData(binderOrder);
            Session["active"] = x;
        }
Beispiel #5
0
 private void GetData(BinderOrder binderOrder)
 {
     dateTextBox.Value           = binderOrder.Date;
     yearTextBox.Text            = binderOrder.Year;
     orderNoTextBox.Text         = binderOrder.OrderNo;
     binderNameDropDownList.Text = binderOrder.BinderName;
     groupCodeDropDownList.Text  = binderOrder.GroupCode;
     bookCodeDropDownList.Text   = binderOrder.BookCode;
     quantityTextBox.Text        = binderOrder.Quantity.ToString();
     formaQuantityTextBox.Text   = binderOrder.FormaQuantity.ToString();
     pressNameDropDownList.Text  = binderOrder.PressName;
     formaTextBox.Text           = binderOrder.Forma.ToString();
 }
Beispiel #6
0
 private static void GetValueFromDatabase(BinderOrder binderOrder, SqlDataReader reader)
 {
     binderOrder.BinderOrderId = int.Parse(reader["id"].ToString());
     binderOrder.Date          = reader["date"].ToString();
     binderOrder.Year          = reader["year"].ToString();
     binderOrder.OrderNo       = reader["order_no"].ToString();
     binderOrder.BinderName    = reader["binder_id"].ToString();
     binderOrder.GroupCode     = reader["group_id"].ToString();
     binderOrder.BookCode      = reader["book_id"].ToString();
     binderOrder.Quantity      = Convert.ToDouble(reader["quantity"].ToString());
     binderOrder.FormaQuantity = Convert.ToDouble(reader["forma_quantity"].ToString());
     binderOrder.PressName     = reader["press_id"].ToString();
     binderOrder.Forma         = Convert.ToDouble(reader["forma"].ToString());
 }
Beispiel #7
0
        public int Insert(BinderOrder binderOrder)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "INSERT INTO tbl_binderOrder VALUES('" + binderOrder.Date + "','" + binderOrder.Year + "','" + binderOrder.OrderNo + "','" +
                                       binderOrder.BinderId + "','" + binderOrder.GroupId + "','" + binderOrder.BookId + "','" +
                                       binderOrder.Quantity + "','" + binderOrder.FormaQuantity + "','" + binderOrder.PressId +
                                       "','" + binderOrder.Forma + "')";
            SqlCommand command = new SqlCommand(query, connection);

            connection.Open();
            int rowAffected = command.ExecuteNonQuery();

            connection.Close();
            return(rowAffected);
        }
Beispiel #8
0
        protected void previousButton_Click(object sender, EventArgs e)
        {
            int active = (int)Session["active"];

            active--;
            List <BinderOrder> binderOrderList = (List <BinderOrder>)(Session["binderOrder"]);

            if (active <= -1)
            {
                active = binderOrderList.Count - 1;
            }
            BinderOrder binderOrder = binderOrderManager.GetBinderOrder(active);

            GetData(binderOrder);
            Session["active"] = active;
        }
Beispiel #9
0
        protected void nextButton_Click(object sender, EventArgs e)
        {
            int active = (int)Session["active"];

            active++;
            List <BinderOrder> binderOrderList = (List <BinderOrder>)(Session["binderOrder"]);

            if (active >= binderOrderList.Count)
            {
                active = 0;
            }
            BinderOrder binderOrder = binderOrderManager.GetBinderOrder(active);

            GetData(binderOrder);
            Session["active"] = active;
        }
Beispiel #10
0
        public BinderOrder GetBinderOrder(int i)
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT * FROM tbl_binderOrder ORDER BY id ASC OFFSET " + i + " ROWS FETCH NEXT 1 ROWS ONLY";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader      = command.ExecuteReader();
            BinderOrder   binderOrder = new BinderOrder();

            while (reader.Read())
            {
                GetValueFromDatabase(binderOrder, reader);
            }
            reader.Close();
            connection.Close();
            return(binderOrder);
        }
Beispiel #11
0
        public BinderOrder GetNextOrderNo()
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT TOP 1 * FROM tbl_binderOrder ORDER BY id DESC";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader reader      = command.ExecuteReader();
            BinderOrder   binderOrder = new BinderOrder();

            while (reader.Read())
            {
                binderOrder.BinderOrderId = int.Parse(reader["id"].ToString());
                binderOrder.OrderNo       = reader["order_no"].ToString();
            }
            reader.Close();
            connection.Close();
            return(binderOrder);
        }
Beispiel #12
0
        private string LoadNextOrderNo()
        {
            BinderOrder binderOrder = binderOrderManager.GetNextOrderNo();
            string      orderNo     = binderOrder.OrderNo;
            int         count;

            if (orderNo == null)
            {
                count = 1;
            }
            else
            {
                count = (orderNo[2] - '0') * 10 + (orderNo[3] - '0') + 1;
            }

            string nextOrderNo = "Or" + count.ToString("00");

            return(nextOrderNo);
        }
Beispiel #13
0
        public List <BinderOrder> GetAllBinderOrder()
        {
            SqlConnection connection = new SqlConnection(connectionString);
            string        query      = "SELECT * FROM tbl_binderOrder";
            SqlCommand    command    = new SqlCommand(query, connection);

            connection.Open();
            SqlDataReader      reader          = command.ExecuteReader();
            List <BinderOrder> binderOrderList = new List <BinderOrder>();

            while (reader.Read())
            {
                BinderOrder binderOrder = new BinderOrder();
                GetValueFromDatabase(binderOrder, reader);
                binderOrderList.Add(binderOrder);
            }
            reader.Close();
            connection.Close();
            return(binderOrderList);
        }