Press Ctrl+V and Submit the Post !!!!!!!!!!!!!!

3.5G

Well-known member
  • Jan 4, 2009
    1,653
    162
    63
    404 - Not Found
    using System;
    using System.Collections;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Data;
    using System.Data.OleDb;
    using System.Windows.Forms;


    namespace Nawco_Systemz.c_db
    {
    class jobOrder_db
    {
    clsOdbc cls_Con = new clsOdbc();
    OleDbCommand cmdForm = new OleDbCommand();
    //************************************************************************************
    //auto id
    public int autoid()
    {
    int id = 0;
    OleDbCommand command = cls_Con.cn.CreateCommand();
    command.CommandText = "SELECT MAX(prid) FROM production";
    cls_Con.cn.Open();
    if (command.ExecuteScalar() != DBNull.Value)
    id = Convert.ToInt32(command.ExecuteScalar());

    cls_Con.cn.Close();
    command.Dispose();

    if (id == 0)
    {
    id = 7541;
    }
    else
    {
    id++;
    }
    return id;
    }
    //add JOB order
    public Boolean add_job_order(b_bis.jobOrder_bis ib)
    {
    try
    {
    this.cls_Con.cmdOpen(cmdForm);
    cmdForm.CommandText = "insert into Production(prid, aid, qty, sdate, edate, status) values (?,?,?,?,?,?)";
    cmdForm.Parameters.Add("@prid", OleDbType.Numeric).Value = ib.p_joid;
    cmdForm.Parameters.Add("@aid", OleDbType.Char).Value = ib.p_asm.p_aid;
    cmdForm.Parameters.Add("@qty", OleDbType.Decimal).Value = ib.p_qty;
    cmdForm.Parameters.Add("@sdate", OleDbType.Date).Value = ib.p_jsdate;
    cmdForm.Parameters.Add("@edate", OleDbType.Date).Value = ib.p_jedate;
    cmdForm.Parameters.Add("@status", OleDbType.Numeric).Value = ib.p_status;

    cls_Con.cmdClose(cmdForm);
    return true;
    }
    catch (Exception exp)
    {
    Console.Write(exp.Message);
    MessageBox.Show(exp.Message);
    return false;
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    }
    //add JOB _ items
    public Boolean add_job_material(b_bis.jobOrder_bis ib)
    {MessageBox.Show(ib.p_mt.p_mid);
    try
    {
    this.cls_Con.cmdOpen(cmdForm);
    cmdForm.CommandText = "insert into pro_mid(prid, mid, type, qty, price, avgprice) values (?,?,?,?,?,?)";


    cmdForm.Parameters.Add("@prid", OleDbType.Numeric).Value = ib.p_joid;
    cmdForm.Parameters.Add("@mid", OleDbType.Char).Value = ib.p_mt.p_mid;
    cmdForm.Parameters.Add("@type", OleDbType.Char).Value = ib.p_descr;
    cmdForm.Parameters.Add("@qty", OleDbType.Decimal).Value = ib.p_qty;
    cmdForm.Parameters.Add("@price", OleDbType.Decimal).Value = ib.p_price;
    cmdForm.Parameters.Add("@avgprice", OleDbType.Decimal).Value = ib.p_avgprice;

    cls_Con.cmdClose(cmdForm);
    return true;
    }
    catch (Exception exp)
    {
    Console.Write(exp.Message);
    MessageBox.Show(exp.Message);
    return false;
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    }
    //**************************************************************************************************
    //add JOB _ items
    public Boolean add_job_extra(b_bis.jobOrder_bis ib)
    {
    try
    {
    this.cls_Con.cmdOpen(cmdForm);
    cmdForm.CommandText = "insert into jo_other(prid, qty, descr, cost) values (?,?,?,?)";
    cmdForm.Parameters.Add("@prid", OleDbType.Numeric).Value = ib.p_joid;
    cmdForm.Parameters.Add("@qty", OleDbType.Numeric).Value = ib.p_qty;
    cmdForm.Parameters.Add("@descr", OleDbType.Char).Value = ib.p_descr;
    cmdForm.Parameters.Add("@cost", OleDbType.Decimal).Value = ib.p_price;
    cls_Con.cmdClose(cmdForm);
    return true;
    }
    catch (Exception exp)
    {
    Console.Write(exp.Message);
    MessageBox.Show(exp.Message);
    return false;
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    }
    //**************************************************************************************************
    //List assembly products
    public ArrayList list_search(string name, string opt, DateTime date1, DateTime date2)
    {
    ArrayList listg = new ArrayList();
    string sql;
    try
    {
    sql = "SELECT Production.prid, Production.aid, Production.qty, Production.sdate, Assembly.name, Production.status" +
    " FROM Assembly INNER JOIN Production ON Assembly.aid = Production.aid"+
    " WHERE Assembly.name LIKE '" + name + "%' ORDER BY Production.prid desc";

    if (opt == "all")
    {
    sql = "SELECT Production.prid, Production.aid, Production.qty, Production.sdate, Assembly.name, Production.status" +
    " FROM Assembly INNER JOIN Production ON Assembly.aid = Production.aid ORDER BY Production.prid desc";
    }
    else if (opt == "sts0")
    {
    sql = "SELECT Production.prid, Production.aid, Production.qty, Production.sdate, Assembly.name, Production.status" +
    " FROM Assembly INNER JOIN Production ON Assembly.aid = Production.aid WHERE Production.status=0 ORDER BY Production.prid desc";
    }
    else if (opt == "date")
    {
    sql = "SELECT Production.prid, Production.aid, Production.qty, Production.sdate, Assembly.name, Production.status" +
    " FROM Assembly INNER JOIN Production ON Assembly.aid = Production.aid WHERE (Production.status=0)"+
    " AND (Production.sdate BETWEEN #" + date1.ToString("d") + "# AND #" + date2.ToString("d") + "#)"+
    " ORDER BY Production.prid desc";
    }
    //MessageBox.Show(sql);

    OleDbCommand cmd = new OleDbCommand(sql, cls_Con.cn);
    cls_Con.cn.Open();
    OleDbDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
    b_bis.jobOrder_bis jt = new b_bis.jobOrder_bis();
    b_bis.assembly_bis at = new b_bis.assembly_bis();

    jt.p_joid = Convert.ToInt32(dr[0]);
    at.p_aid = (string)dr[1];
    at.p_name = (string)dr[4];
    jt.p_asm = at;
    jt.p_qty = Convert.ToDecimal(dr[2]);
    jt.p_jsdate = Convert.ToDateTime(dr[3]);
    jt.p_status = Convert.ToInt32(dr[5]);
    listg.Add(jt);
    }
    cls_Con.cn.Close();
    cmd.Dispose();
    dr.Close();
    }
    catch (Exception exp)
    {
    MessageBox.Show("DB error : " + exp.Message);
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    return listg;
    }
    //************************************************************************************
    //List jobs
    //************************************************************************************
    public ArrayList list_JO(int id)
    {
    ArrayList listx = new ArrayList();
    string sql;
    try
    {
    sql = "select * from Production where prid =" + id;
    //MessageBox.Show(sql);

    OleDbCommand cmd = new OleDbCommand(sql, cls_Con.cn);
    cls_Con.cn.Open();
    OleDbDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
    b_bis.jobOrder_bis jt = new b_bis.jobOrder_bis();
    b_bis.assembly_bis at = new b_bis.assembly_bis();

    jt.p_joid = Convert.ToInt32(dr[0]);
    at.p_aid = (string)dr[1];
    jt.p_asm = at;
    jt.p_qty = Convert.ToDecimal(dr[2]);
    jt.p_jsdate = Convert.ToDateTime(dr[3]);
    jt.p_jedate = Convert.ToDateTime(dr[4]);
    jt.p_status = Convert.ToInt32(dr[5]);
    //MessageBox.Show(met.p_mid + "-" + met.p_name + "-" + met.p_price + "-" + met.p_avgprice + "-" + met.p_qty + "-" + met.p_status);
    listx.Add(jt);
    }
    cls_Con.cn.Close();
    cmd.Dispose();
    dr.Close();
    }
    catch (Exception exp)
    {
    MessageBox.Show("DB error : " + exp.Message);
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    return listx;
    }
    //************************************************************************************
    //List jobs material
    //************************************************************************************
    public ArrayList list_pro_mid(int id)
    {
    ArrayList listx = new ArrayList();
    string sql;
    try
    {
    sql = "SELECT pro_mid.prid, pro_mid.mid, pro_mid.qty, pro_mid.price, pro_mid.avgprice, Material.Name, pro_mid.type" +
    " FROM Material INNER JOIN pro_mid ON Material.mid = pro_mid.mid WHERE pro_mid.prid="+ id;
    //MessageBox.Show(sql);

    OleDbCommand cmd = new OleDbCommand(sql, cls_Con.cn);
    cls_Con.cn.Open();
    OleDbDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
    b_bis.jobOrder_bis jt = new b_bis.jobOrder_bis();
    b_bis.material_bis mt = new b_bis.material_bis();

    jt.p_joid = Convert.ToInt32(dr[0]);
    mt.p_mid = (string)dr[1];
    mt.p_name = (string)dr[5];
    jt.p_mt = mt;
    jt.p_qty = Convert.ToDecimal(dr[2]);
    jt.p_price = Convert.ToDecimal(dr[3]);
    jt.p_avgprice = Convert.ToDecimal(dr[4]);
    jt.p_descr = (string)dr[5];
    listx.Add(jt);
    }
    cls_Con.cn.Close();
    cmd.Dispose();
    dr.Close();
    }
    catch (Exception exp)
    {
    MessageBox.Show("DB error : " + exp.Message);
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    return listx;
    }
    //************************************************************************************
    //List jobs other expenses
    //************************************************************************************
    public ArrayList list_pro_other(int id)
    {
    ArrayList listx = new ArrayList();
    string sql;
    try
    {
    sql = "SELECT * FROM jo_other WHERE prid=" + id;
    //MessageBox.Show(sql);

    OleDbCommand cmd = new OleDbCommand(sql, cls_Con.cn);
    cls_Con.cn.Open();
    OleDbDataReader dr = cmd.ExecuteReader();
    while (dr.Read())
    {
    b_bis.jobOrder_bis jt = new b_bis.jobOrder_bis();
    jt.p_descr = (string)dr[2];
    jt.p_qty = Convert.ToDecimal(dr[3]);
    jt.p_price = Convert.ToDecimal(dr[4]);
    listx.Add(jt);
    }
    cls_Con.cn.Close();
    cmd.Dispose();
    dr.Close();
    }
    catch (Exception exp)
    {
    MessageBox.Show("DB error : " + exp.Message);
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    return listx;
    }

    //add JOB order
    public Boolean add_mati(b_bis.jobOrder_bis ib)
    {
    try
    {
    this.cls_Con.cmdOpen(cmdForm);
    cmdForm.CommandText = "insert into MatI(prid, mdate) values (?,?)";
    cmdForm.Parameters.Add("@prid", OleDbType.Numeric).Value = ib.p_joid;
    cmdForm.Parameters.Add("@mdate", OleDbType.Date).Value = ib.p_jsdate;

    cls_Con.cmdClose(cmdForm);
    return true;
    }
    catch (Exception exp)
    {
    Console.Write(exp.Message);
    MessageBox.Show(exp.Message);
    return false;
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    }
    //update JOB order
    public Boolean update_status(int prid)
    {
    try
    {
    this.cls_Con.cmdOpen(cmdForm);
    cmdForm.CommandText = "UPDATE Production SET status= 1 WHERE prid= ?";
    cmdForm.Parameters.Add("@prid", OleDbType.Numeric).Value = prid;
    cls_Con.cmdClose(cmdForm);
    return true;
    }
    catch (Exception exp)
    {
    Console.Write(exp.Message);
    MessageBox.Show(exp.Message);
    return false;
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    }
    //************************************************************************************
    //auto id
    public int count_mi(int id)
    {
    int idx=0;
    OleDbCommand command = cls_Con.cn.CreateCommand();
    command.CommandText = "SELECT max(id) FROM MatI WHERE prid=" + id;
    cls_Con.cn.Open();
    if (command.ExecuteScalar() != DBNull.Value)
    {
    idx = Convert.ToInt32(command.ExecuteScalar());
    }

    cls_Con.cn.Close();
    command.Dispose();
    return idx;
    }
    //Delete material issue
    public Boolean delmat(int prid)
    {
    try
    {
    this.cls_Con.cmdOpen(cmdForm);
    cmdForm.CommandText = "Delete * From MatI where prid= ?";
    cmdForm.Parameters.Add("@prid", OleDbType.Numeric).Value = prid;
    cls_Con.cmdClose(cmdForm);
    return true;
    }
    catch (Exception exp)
    {
    Console.Write(exp.Message);
    MessageBox.Show(exp.Message);
    return false;
    }
    finally
    {
    this.cls_Con.cn.Close();
    }
    }
    }
    }
     

    කාඩ රජා

    Active member
  • Apr 23, 2010
    624
    32
    28
    අනේ මංදා මෙව්වා...
    ඕන එකක්..
    දැන් මේ යන විදිහට ඔයා අඩයි වගේ...
    ඔන්න මමනං නෑ මේවට...
    ඔන්න සහොදරී අපි අහිංසකයි හොදේ...
    :ඩී
     

    menaka4u

    Well-known member
  • Apr 2, 2009
    1,349
    125
    63
    39
    kurunegala
    pubudu2008
    user_online.gif

    Senior Member
    reputation_pos.gif
    reputation_pos.gif
    reputation_pos.gif

    Posts: 6,766
    Blog Entries: 3
    Join Date: Dec 2007
    Location: Colombo 10.



    08-04-2009, 01:25 PM

    http://www.elakiri.com/forum/showthread.php?t=217250

     

    ||~R_girl~||

    Member
    Mar 21, 2008
    34,536
    460
    0
    first off u can not deny the fact that shes beautiful,u have to be blind to not see that shes really hot.and i however agree with people when they say that she cant act,yes shes not a good actress,the reason i love her is that shes really attractive and i can not help it.she can not act yeah but shes very attractive.and those who say that megan cant act, how many of you girls actually say that 'wow robbert pattinson is the best,taylor lautner is the best actor ever' when they are not.twilight is a dumb cheesy movie made for mindless people with horrible actors,but does that stop you from liking pattinson or lautner,no cause eventhough they cant act girls find them attractive.so its understandable right
    20 hours ago · Flag

    Marrisa Rose Smith Of course Megan is beautiful, she just can't act and is there for eye candy like some other models who act and women who can't act like Mila from the Resident Evil movies. Robbert and all the cast of twilight are not attractive, just nothing but make up and a boring chick flick movie with too much hype.
    20 hours ago · Flag

    Christy Exclusíve B ahahahaha!
    yeah with all the plastic surgeries on!
    ;)
    nice "original" beauty!
    18 hours ago · Flag

    Gayan Aves Wickramasinghe i dont care if her skin is fake or not,its still attractive and she really turns me on
    3 hours ago · Flag

    Christy Exclusíve B this is cause you have to find yourself a girlfriend ;)
    aahahahaha!
    3 hours ago · Flag

    Gayan Aves Wickramasinghe i do have a girlfriend.and even she thinks megan fox is hot
    11 minutes ago · Flag