Example #1
0
        public DataTable SelectChk(string MCode)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plistChk = new CSQLParameterList();
                    plistChk.Add("@MCode", DbType.String, MCode, ParameterDirection.Input);
                    CSQLDataAdepterList adlistChk = new CSQLDataAdepterList();
                    CSQLStatementValue  csvChk    = new CSQLStatementValue(this._statement, plistChk, NoomLibrary.StatementType.Select);
                    adlistChk.Add(csvChk);
                    cstate.Open();
                    DataTable dt = (DataTable)cstate.Execute(adlistChk);;

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
Example #2
0
        public void addOrder(int proid, int qty, int price, int userid, DateTime ordertime)
        {
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@ProductID", DbType.Int32, proid, ParameterDirection.Input);
                plist.Add("@OrderQty", DbType.Int32, qty, ParameterDirection.Input);
                plist.Add("@OrderPrice", DbType.Int32, price, ParameterDirection.Input);
                plist.Add("@UserID", DbType.Int32, userid, ParameterDirection.Input);
                plist.Add("@OrderTime", DbType.DateTime, ordertime, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Insert);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);

                //DataTable dt = (DataTable)result;

                //this._orderlist = dt.ToDictionary<int, Order>("OrderID");
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #3
0
        public void deleteTypeProduct(int typeid)
        {
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@TypeID", DbType.String, typeid, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememetType, plist, NoomLibrary.StatementType.Delete);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #4
0
        public void searchProduct(string keyname)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@KeyName", DbType.String, keyname, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._searchProduct, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();

                result = cstate.Execute(adlist);
                DataTable dt = (DataTable)result;

                this.productlist = dt.ToDictionary <int, Product>("ProductID");

                ProductAll = dt;
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #5
0
        public void editProduct(int productid, string productname, int productprice, string productdetail, int typeid)
        {
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@ProductID", DbType.String, productid, ParameterDirection.Input);
                plist.Add("@ProductName", DbType.String, productname, ParameterDirection.Input);
                plist.Add("@ProductPrice", DbType.Int32, productprice, ParameterDirection.Input);
                plist.Add("@ProductDetail", DbType.String, productdetail, ParameterDirection.Input);
                plist.Add("@TypeProduct", DbType.Int32, typeid, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Update);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #6
0
        public void selectPromotion()
        {
            object         result = null;
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();

                result = cstate.Execute(adlist);
                DataTable dt = (DataTable)result;

                this._promotionlist = dt.ToDictionary <int, Promotion>("PromotionID");
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #7
0
        public void updateCarInfo(int poid, string carplate, DateTime _RegisDate, string cartax, int cartype)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@POID", DbType.Int32, poid, ParameterDirection.Input);
                plist.Add("@CarPlate", DbType.String, carplate, ParameterDirection.Input);
                plist.Add("@Regis_Date", DbType.Date, _RegisDate, ParameterDirection.Input);
                plist.Add("@CarTax", DbType.String, cartax, ParameterDirection.Input);
                plist.Add("@CarType", DbType.Int32, cartype, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet2, plist, NoomLibrary.StatementType.Update);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);
                //this._invoicelist = dt.ToDictionary<int, _Invoice>("PurchaseID");
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #8
0
        public void selectCustomer(int userid)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@UserID", DbType.Int32, userid, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();

                result = cstate.Execute(adlist);
                DataTable dt = (DataTable)result;

                this._customer = dt.ToDictionary <int, Customer>("UserID");
                CustomerAll    = dt;

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #9
0
        public void editPromotion(int promotionid, string promotionname, string promotiondiscount, int promotiontype)
        {
            CStatementList cstate = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@PromotionID", DbType.Int32, promotionid, ParameterDirection.Input);
                plist.Add("@PromotionName", DbType.String, promotionname, ParameterDirection.Input);
                plist.Add("@PromotionDiscount", DbType.String, promotiondiscount, ParameterDirection.Input);
                plist.Add("@PromotionType", DbType.Int32, promotiontype, ParameterDirection.Input);


                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Update);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #10
0
        public DataTable getData(DateTime date_count_stock, int id_brach, int count)
        {
            String         count_stock = date_count_stock.ToString("yyyy-MM-dd");
            DataTable      _dt         = new DataTable();
            CStatementList cstate      = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@Date_Count_Stock", DbType.String, count_stock, ParameterDirection.Input);
                plist.Add("@ID_Brach", DbType.Int32, id_brach, ParameterDirection.Input);
                plist.Add("@Rount", DbType.Int32, count, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();
                cstate.Execute(adlist);
                _dt = (DataTable)cstate.Execute(adlist);
                foreach (DataRow item in _dt.Rows)
                {
                    SpaceParts spaceParts = new SpaceParts();
                    spaceParts.ID_Item          = item["ID_Item"].ToString();
                    spaceParts.Name_Item        = item["Name_Item"].ToString();
                    spaceParts.Group_Item       = item["Group_Item"].ToString();
                    spaceParts.Sell_Price_Unit  = Convert.ToDouble(item["Sell_Price_Unit"]);
                    spaceParts.Sell_Price_All   = Convert.ToDouble(item["Sell_Price_All"]);
                    spaceParts.Cost_Price_Unit  = Convert.ToDouble(item["Cost_Price_Unit"]);
                    spaceParts.Cost_Price_All   = Convert.ToDouble(item["Cost_Price_All"]);
                    spaceParts.Date_Count_Stock = Convert.ToDateTime(item["Date_Count_Stock"]);
                    spaceParts.Shelf_Main       = item["Self_Main"].ToString() == null ? "" : item["Self_Main"].ToString();
                    //spaceParts.Round = Convert.ToInt32(item["Count_Round"]);
                    spaceParts.Total_Stock          = Convert.ToInt32(item["Total_Stock"]);
                    spaceParts.Amound_Sold          = Convert.ToInt32(item["Amound_Sold"]);
                    spaceParts.Number_Parts_Booking = Convert.ToInt32(item["Number_Parts_Booking"]);
                    spaceParts.Inventory_Last_Month = Convert.ToInt32(item["Inventory_Last_Month"]);
                    spaceParts.Count_Value          = item["Get_Count"].ToString() == "" ? 0 : Convert.ToDouble(item["Get_Count"]);
                    spaceParts.Different            = item["Count_Value"].ToString() == "" ? 0 : Convert.ToDouble(item["Count_Value"]);
                    spaceParts.Different_Cost       = item["Cost_Count_Value"].ToString() == "" ? 0 : Convert.ToDouble(item["Cost_Count_Value"]);
                }

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
            return(_dt);
        }
Example #11
0
        public object Select(int num, int BookID)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@BookID", DbType.Int32, BookID, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        int      id = int.Parse(item["ID"].ToString());
                        _Inregis _c = new _Inregis();
                        _c.ID     = id;
                        _c.Name   = item["Name"].ToString();
                        _c.InName = item["InName"].ToString();
                        if (item["InID"].ToString() != string.Empty)
                        {
                            _c.InID = int.Parse(item["InID"].ToString());
                        }
                        _c.Budget  = decimal.Parse(item["Budget"].ToString());
                        _c.Free    = item["Free"].ToString();
                        _c.CarType = item["CarType"].ToString();
                        this.Add(id, _c);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Example #12
0
        public void editInvoice(int poid, string invoice_date, string getinvoice_date, string tran_date, string getguide_date, string getbadge_date, string noteset_date, string getnoteset_date, string remarkInvoice)
        //public void editInvoice(int poid)
        {
            //DateTime minValue = (DateTime)System.Data.SqlTypes.SqlDateTime.Null;
            //DateTime? TimeTo;
            var dt  = InvoiceAll;
            var row = dt.Rows[0];

            invoice._Invoice_Date    = (invoice_date == string.Empty || invoice_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(invoice_date.ToString());
            invoice._GetInvoice_Date = (getinvoice_date == string.Empty || getinvoice_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(getinvoice_date.ToString());
            invoice._Transport_Date  = (tran_date == string.Empty || tran_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(tran_date.ToString());
            invoice._GetGuide        = (getguide_date == string.Empty || getguide_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(getguide_date.ToString());
            invoice._GetBadge_Date   = (getbadge_date == string.Empty || getbadge_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(getbadge_date.ToString());
            invoice._NoteSet_Date    = (noteset_date == string.Empty || noteset_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(noteset_date.ToString());
            invoice._GetNotSet_Date  = (getnoteset_date == string.Empty || getnoteset_date == "ไม่ระบุ") ? DateTime.MinValue : Convert.ToDateTime(getnoteset_date.ToString());
            invoice._RemarkInvoice   = (remarkInvoice == string.Empty || remarkInvoice == "ไม่ระบุ") ? String.Empty : remarkInvoice.ToString();

            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@POID", DbType.Int32, poid, ParameterDirection.Input);
                plist.Add("@Invoice_Date", DbType.Date, invoice._Invoice_Date, ParameterDirection.Input);
                plist.Add("@GetInvoice_Date", DbType.Date, invoice._GetInvoice_Date, ParameterDirection.Input);
                plist.Add("@Transport_Date", DbType.Date, invoice._Transport_Date, ParameterDirection.Input);
                plist.Add("@GetGuide_Date", DbType.Date, invoice._GetGuide, ParameterDirection.Input);
                plist.Add("@GetBadge_Date", DbType.Date, invoice._GetBadge_Date, ParameterDirection.Input);
                plist.Add("@NoteSet_Date", DbType.Date, invoice._NoteSet_Date, ParameterDirection.Input);
                plist.Add("@GetNoteSet_Date", DbType.Date, invoice._GetNotSet_Date, ParameterDirection.Input);
                plist.Add("@RemarkInvoice", DbType.String, invoice._RemarkInvoice, ParameterDirection.Input);


                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Update);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);
                //this._invoicelist = dt.ToDictionary<int, _Invoice>("PurchaseID");
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #13
0
        public object SelectEmpSale(int num, string Company, string Branch, int EmpID)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@Company", DbType.String, Company, ParameterDirection.Input);
                    plist.Add("@Branch", DbType.String, Branch, ParameterDirection.Input);
                    plist.Add("@EmpID", DbType.Int32, EmpID, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statementEmpSale, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        string FullName = item["FullName"].ToString();
                        int    Emp_ID   = int.Parse(item["Emp_id"].ToString());

                        Tb_User _u = new Tb_User();
                        _u.FullName = FullName;
                        _u.EmpID    = Emp_ID;

                        this.Add(Emp_ID, _u);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Example #14
0
            public void Select(int num, string Username, string Password, int ID)
            {
                CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

                try
                {
                    try
                    {
                        CSQLParameterList plist = new CSQLParameterList();
                        plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                        plist.Add("@ID", DbType.Int32, ID, ParameterDirection.Input);
                        plist.Add("@Username", DbType.String, Username, ParameterDirection.Input);
                        plist.Add("@Password", DbType.String, Password, ParameterDirection.Input);
                        CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                        CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                        adlist.Add(csvUser);
                        cstate.Open();
                        DataTable dt = (DataTable)cstate.Execute(adlist);;

                        if (dt.Rows.Count > 0)
                        {
                            this.ID       = int.Parse(dt.Rows[0]["ID"].ToString());
                            this.Username = dt.Rows[0]["Username"].ToString();
                            this.Password = dt.Rows[0]["Password"].ToString();
                            this.FullName = dt.Rows[0]["SaleName"].ToString();
                            this.EmpID    = int.Parse(dt.Rows[0]["Emp_id"].ToString());
                            this.UserType = int.Parse(dt.Rows[0]["UserType"].ToString());
                            this.NickName = dt.Rows[0]["NickName"].ToString();
                            this.Company  = dt.Rows[0]["Company"].ToString();
                            this.Branch   = dt.Rows[0]["Branch"].ToString();
                            this.Team     = dt.Rows[0]["Team"].ToString();
                        }

                        cstate.Commit();
                    }
                    catch (SqlException)
                    {
                        cstate.Rollback();
                        throw;
                    }
                    finally
                    {
                        cstate.Close();
                    }
                }
                catch (Exception)
                {
                    throw;
                }
            }
Example #15
0
        public object Select_Branch(int num, string Company, string BranchCode, string BranchName)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@Company", DbType.String, Company, ParameterDirection.Input);
                    plist.Add("@BranchCode", DbType.String, BranchCode, ParameterDirection.Input);
                    plist.Add("@BranchName", DbType.String, BranchName, ParameterDirection.Input);
                    CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                    CSQLStatementValue  csv    = new CSQLStatementValue(this._statementB, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csv);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        int     id = int.Parse(item["ID"].ToString());
                        _Branch _b = new _Branch();
                        _b._Company.Companycode = item["Company"].ToString();
                        _b.Branchcode           = item["Branch"].ToString();
                        _b.BranchName           = item["BranchName"].ToString();
                        this.Add(id, _b);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Example #16
0
        public object Body_Select_Option(int Body_Acc_ID)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@Body_Acc_ID", DbType.Int32, Body_Acc_ID, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        int        Option_ID = int.Parse(item["Body_Option_ID"].ToString());
                        BodyOption _SetAcc   = new BodyOption();
                        _SetAcc.Body_Option_ID    = Option_ID;
                        _SetAcc.Body_Option_Name  = item["Body_Option_Name"].ToString();
                        _SetAcc.Option_Name       = item["Option_Name"].ToString();
                        _SetAcc.Body_Option_price = decimal.Parse(item["Body_Option_price"].ToString());
                        //_SetAcc.finance = item["finance"].ToString();

                        this.Add(Option_ID, _SetAcc);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Example #17
0
        public DataTable selectInvoiceReport(int poid)
        {
            //object result = null;
            DataTable      _dt    = new DataTable();
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@POID", DbType.String, poid, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();

                _dt = (DataTable)cstate.Execute(adlist);
                //DataTable dt = (DataTable)result;
                InvoiceAll = _dt;

                invoice = new _Invoice();
                var item = _dt.Rows[0];

                invoice._Invoice_Date    = item["Invoice_Date"].ToString() == null || item["Invoice_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Invoice_Date"].ToString());
                invoice._GetInvoice_Date = item["GetInvoice_Date"].ToString() == null || item["GetInvoice_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetInvoice_Date"].ToString());
                invoice._NoteSet_Date    = item["NoteSet_Date"].ToString() == null || item["NoteSet_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["NoteSet_Date"].ToString());
                invoice._GetNotSet_Date  = item["GetNoteSet_Date"].ToString() == null || item["GetNoteSet_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetNoteSet_Date"].ToString());
                invoice._Transport_Date  = item["Transport_Date"].ToString() == null || item["Transport_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Transport_Date"].ToString());
                invoice._GetGuide        = item["GetGuide_Date"].ToString() == null || item["GetGuide_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetGuide_Date"].ToString());
                invoice._GetBadge_Date   = item["GetBadge_Date"].ToString() == null || item["GetBadge_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetBadge_Date"].ToString());
                invoice._RemarkInvoice   = item["RemarkInvoice"].ToString() == string.Empty || item["RemarkInvoice"].ToString() == "" ? "-" : item["RemarkInvoice"].ToString();

                //_InvoiceList invoice = new _InvoiceList(_invoicedate, _getinvoicedate, _trandate, _getguide, _getbadge, _noteset, _getnoteset);

                //this._invoicelist = dt.ToDictionary<int, _Invoice>("PurchaseID");
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
            return(_dt);
        }
Example #18
0
        public object Select(int num, int Province_ID, int Amphur_ID)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@Province_ID", DbType.Int32, Province_ID, ParameterDirection.Input);
                    plist.Add("@Amphur_ID", DbType.Int32, Amphur_ID, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        int       id = int.Parse(item["DISTRICT_ID"].ToString());
                        _District _c = new _District();
                        _c.DISTRICT_ID   = id;
                        _c.DISTRICT_NAME = item["DISTRICT_NAME"].ToString();

                        this.Add(id, _c);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Example #19
0
        public void savedata(string id_item, string name_item, string group_item, double sell_price_unit, double sell_price_all, double cost_price_unit, double cost_price_all, string shelf_main, string shelf_try, string date_count_stock, double total_stock, double amound_sold, double number_part_booking, double invertory_last_month, int id_brach)
        {
            IFormatProvider culture    = new CultureInfo("en-US", true);
            DateTime        date_count = Convert.ToDateTime(date_count_stock);

            date_count.ToString("dd-MM-yyyy");
            DateTime       date_count2 = Convert.ToDateTime(date_count.Date);
            CStatementList cstate      = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@ID_Item", DbType.String, id_item, ParameterDirection.Input);
                plist.Add("@Name_Item", DbType.String, name_item, ParameterDirection.Input);
                plist.Add("@Group_Item", DbType.String, group_item, ParameterDirection.Input);
                plist.Add("@Sell_Price_Unit", DbType.Double, sell_price_unit, ParameterDirection.Input);
                plist.Add("@Sell_Price_All", DbType.Double, sell_price_all, ParameterDirection.Input);
                plist.Add("@Cost_Price_Unit", DbType.Double, cost_price_unit, ParameterDirection.Input);
                plist.Add("@Cost_Price_All", DbType.Double, cost_price_all, ParameterDirection.Input);
                plist.Add("@Shelf_Main", DbType.String, shelf_main, ParameterDirection.Input);
                plist.Add("@Shelf_Try", DbType.String, shelf_try, ParameterDirection.Input);
                plist.Add("@Date_Count_Stock", DbType.Date, DateTime.Now, ParameterDirection.Input);
                //plist.Add("@Round", DbType.Int32, round, ParameterDirection.Input);
                plist.Add("@Total_Stock", DbType.Double, total_stock, ParameterDirection.Input);
                plist.Add("@Amound_Sold", DbType.Double, amound_sold, ParameterDirection.Input);
                plist.Add("@Number_Parts_Booking", DbType.Double, number_part_booking, ParameterDirection.Input);
                plist.Add("@Inventory_Last_Month", DbType.Double, invertory_last_month, ParameterDirection.Input);
                plist.Add("@ID_Brach", DbType.Int32, id_brach, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Insert);
                adlist.Add(csv);
                cstate.Open();

                cstate.Execute(adlist);

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
        }
Example #20
0
        public object Select(int num, int BookID)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@BookID", DbType.Int32, BookID, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    result = cstate.Execute(adlist);
                    DataTable dt = (DataTable)result;

                    foreach (DataRow item in dt.Rows)
                    {
                        int             id      = int.Parse(item["ID"].ToString());
                        _AccessoriesSTD _AccSTD = new _AccessoriesSTD();
                        _AccSTD.ID   = id;
                        _AccSTD.Name = item["Name"].ToString();

                        this.Add(id, _AccSTD);
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(result);
        }
Example #21
0
        public int getCount_Item(DateTime date_count_stock, int id_brach, int count, string type_item)
        {
            int       countitem = 0;
            DataTable _dt       = new DataTable();
            TreePetch treePetch = new TreePetch();

            String         count_stock = date_count_stock.ToString("yyyy-MM-dd");
            CStatementList cstate      = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@Date_Count_Stock", DbType.String, count_stock, ParameterDirection.Input);
                plist.Add("@ID_Brach", DbType.Int32, id_brach, ParameterDirection.Input);
                plist.Add("@Round", DbType.Int32, count, ParameterDirection.Input);
                plist.Add("@Type_Item", DbType.String, type_item, ParameterDirection.Input);


                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet_Count, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();
                cstate.Execute(adlist);

                _dt = (DataTable)cstate.Execute(adlist);

                foreach (DataRow item in _dt.Rows)
                {
                    treePetch.T_Count_Item = Convert.ToInt32(item["Count_Item"]);
                    countitem = Convert.ToInt32(item["Count_Item"]);
                }

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
            return(countitem);
        }
Example #22
0
        public object selectInvoice(int poid)
        {
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@POID", DbType.String, poid, ParameterDirection.Input);

                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();

                result = cstate.Execute(adlist);
                DataTable dt = (DataTable)result;
                InvoiceAll = dt;

                invoice = new _Invoice();
                var item = dt.Rows[0];

                invoice._Invoice_Date    = item["Invoice_Date"].ToString() == null || item["Invoice_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Invoice_Date"].ToString());
                invoice._GetInvoice_Date = item["GetInvoice_Date"].ToString() == null || item["GetInvoice_Date"].ToString() == ""? DateTime.MinValue : DateTime.Parse(item["GetInvoice_Date"].ToString());
                invoice._NoteSet_Date    = item["NoteSet_Date"].ToString() == null || item["NoteSet_Date"].ToString() == ""? DateTime.MinValue : DateTime.Parse(item["NoteSet_Date"].ToString());
                invoice._GetNotSet_Date  = item["GetNoteSet_Date"].ToString() == null || item["GetNoteSet_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetNoteSet_Date"].ToString());
                invoice._Transport_Date  = item["Transport_Date"].ToString() == null || item["Transport_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["Transport_Date"].ToString());
                invoice._GetGuide        = item["GetGuide_Date"].ToString() == null || item["GetGuide_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetGuide_Date"].ToString());
                invoice._GetBadge_Date   = item["GetBadge_Date"].ToString() == null || item["GetBadge_Date"].ToString() == "" ? DateTime.MinValue : DateTime.Parse(item["GetBadge_Date"].ToString());
                invoice._RemarkInvoice   = item["RemarkInvoice"].ToString() == string.Empty || item["RemarkInvoice"].ToString() == "" ? "-" : item["RemarkInvoice"].ToString();

                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
            return(result);
        }
Example #23
0
        public double getDifCoast_Plus_EA(DateTime date_count_stock, int id_brach, int count, string type_item)
        {
            DataTable      _dt             = new DataTable();
            double         DIF_Total_Coast = 0;
            String         count_stock     = date_count_stock.ToString("yyyy-MM-dd");
            CStatementList cstate          = new CStatementList(Connection.CSQLConnection);

            try
            {
                CSQLParameterList plist = new CSQLParameterList();
                plist.Add("@Date_Count_Stock", DbType.String, count_stock, ParameterDirection.Input);
                plist.Add("@ID_Brach", DbType.Int32, id_brach, ParameterDirection.Input);
                plist.Add("@Round", DbType.Int32, count, ParameterDirection.Input);
                plist.Add("@Type_Item", DbType.String, type_item, ParameterDirection.Input);


                CSQLDataAdepterList adlist = new CSQLDataAdepterList();
                CSQLStatementValue  csv    = new CSQLStatementValue(this._statememet_Plus_EA, plist, NoomLibrary.StatementType.Select);
                adlist.Add(csv);
                cstate.Open();
                cstate.Execute(adlist);

                _dt = (DataTable)cstate.Execute(adlist);

                foreach (DataRow item in _dt.Rows)
                {
                    Dealer dealer = new Dealer();
                    dealer.IS_Coast_Plus_EA = Convert.ToInt64(item["DIF_Total_Coast"]);
                    DIF_Total_Coast         = Convert.ToDouble(item["DIF_Total_Coast"]);
                }
                cstate.Commit();
            }
            catch (Exception ex)
            {
                string error = ex.Message;
                cstate.Rollback();
            }
            finally
            {
                cstate.Close();
            }
            return(DIF_Total_Coast);
        }
Example #24
0
        public void Select(int num, string _M, string _Y)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@_Month", DbType.String, _M, ParameterDirection.Input);
                    plist.Add("@_Year", DbType.String, _Y, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statementMaxCusNo, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    DataTable dt = (DataTable)cstate.Execute(adlist);;

                    if (dt.Rows.Count > 0)
                    {
                        this.CusNo = dt.Rows[0]["CusNo"].ToString();
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #25
0
        public void SelectRedCarPlate(int num)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@POID", DbType.Int32, num, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    DataTable dt  = (DataTable)cstate.Execute(adlist);
                    var       row = dt.Rows[0];
                    RedCarPlate_DATE  = DateTime.Parse(row["RedCarPlate_Date"].ToString());
                    RedCarPlate_NO    = row["RedCarPlate_No"].ToString();
                    RedCarPlate_PRICE = Decimal.Parse(row["RedCarplate_Price"].ToString());
                    RedCarPlate_NUM   = row["RedCarPlate_Num"].ToString();
                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                RedCarPlate_DATE  = DateTime.MinValue;
                RedCarPlate_NO    = string.Empty;
                RedCarPlate_PRICE = 0;
                RedCarPlate_NUM   = string.Empty;
            }
        }
Example #26
0
        public void Select(int num, int District_ID)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@District_ID", DbType.Int32, District_ID, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    DataTable dt = (DataTable)cstate.Execute(adlist);;

                    if (dt.Rows.Count > 0)
                    {
                        this.Postel_Code = dt.Rows[0]["Postel_Code"].ToString();
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #27
0
        public void SelectChk(int num, string MCNumber)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plistChk = new CSQLParameterList();
                    plistChk.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plistChk.Add("@MC_Number", DbType.String, MCNumber, ParameterDirection.Input);
                    CSQLDataAdepterList adlistChk = new CSQLDataAdepterList();
                    CSQLStatementValue  csvChk    = new CSQLStatementValue(this._statementChk, plistChk, NoomLibrary.StatementType.Select);
                    adlistChk.Add(csvChk);
                    cstate.Open();
                    DataTable dt = (DataTable)cstate.Execute(adlistChk);;

                    if (dt.Rows.Count > 0)
                    {
                        this._Purchase.ID = int.Parse(dt.Rows[0]["ID"].ToString());
                    }
                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #28
0
        public DataTable Select_CarType2(int num)
        {
            DataTable      dt     = new DataTable();
            object         result = null;
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@ID", DbType.Int32, num, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement2, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    result  = cstate.Execute(adlist);
                    dt      = (DataTable)result;
                    TypeCar = dt;

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(dt);
        }
Example #29
0
        public void Select(int num, string _IDCard)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@IDCard", DbType.String, _IDCard, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    DataTable dt = (DataTable)cstate.Execute(adlist);;

                    if (dt.Rows.Count > 0)
                    {
                        this.ID              = int.Parse(dt.Rows[0]["ID"].ToString());
                        this.CusNo           = dt.Rows[0]["CusNo"].ToString();
                        this.CusType         = dt.Rows[0]["CusType"].ToString();
                        this.CorporationCode = dt.Rows[0]["CorporationCode"].ToString();
                        this.IDCard          = dt.Rows[0]["IDCard"].ToString();
                        this.Prefix          = dt.Rows[0]["Prefix"].ToString();
                        this.Name            = dt.Rows[0]["Name"].ToString();
                        this.Surname         = dt.Rows[0]["Surname"].ToString();
                        this.Nickname        = dt.Rows[0]["Nickname"].ToString();
                        this.Sex             = dt.Rows[0]["Sex"].ToString();
                        if (dt.Rows[0]["Birthday"].ToString() != string.Empty && dt.Rows[0]["Birthday"].ToString() != null)
                        {
                            this.Birthday = DateTime.Parse(dt.Rows[0]["Birthday"].ToString());
                        }

                        string _Education = dt.Rows[0]["Education"].ToString();
                        if (_Education != string.Empty && _Education != null)
                        {
                            this._Education.id = int.Parse(dt.Rows[0]["Education"].ToString());
                        }


                        string _Total_Member = dt.Rows[0]["Total_Member"].ToString();
                        if (_Total_Member != string.Empty && _Total_Member != null)
                        {
                            this.Total_Member = int.Parse(dt.Rows[0]["Total_Member"].ToString());
                        }

                        this.Tel_Mobile1   = dt.Rows[0]["Tel_Mobile1"].ToString();
                        this.Tel_Mobile2   = dt.Rows[0]["Tel_Mobile2"].ToString();
                        this.Tel_Work      = dt.Rows[0]["Tel_Work"].ToString();
                        this.Tel_Fax       = dt.Rows[0]["Tel_Fax"].ToString();
                        this._Career.ID    = int.Parse(dt.Rows[0]["CareerID"].ToString());
                        this.Career_Other  = dt.Rows[0]["Career_Other"].ToString();
                        this.Career_Remark = dt.Rows[0]["Career_Remark"].ToString();
                        this._Income.ID    = int.Parse(dt.Rows[0]["IncomeID"].ToString());
                        string _SendAdd = dt.Rows[0]["SendAddress_IDCard"].ToString();
                        this.SendAddress_IDCard = _SendAdd;

                        _AddressList._Address _add = new _AddressList._Address();
                        _add.Address = dt.Rows[0]["Address"].ToString();
                        if (dt.Rows[0]["Add_Moo"].ToString() != string.Empty)
                        {
                            _add.Add_Moo = int.Parse(dt.Rows[0]["Add_Moo"].ToString());
                        }
                        else
                        {
                            _add.Add_Moo = 0;
                        }

                        _add.Add_HomeName            = dt.Rows[0]["Add_HomeName"].ToString();
                        _add.Add_Road                = dt.Rows[0]["Add_Road"].ToString();
                        _add.Add_Soi                 = dt.Rows[0]["Add_Soi"].ToString();
                        _add._District.DISTRICT_ID   = int.Parse(dt.Rows[0]["Add_District"].ToString());
                        _add._District.DISTRICT_NAME = dt.Rows[0]["DISTRICT_NAME"].ToString();
                        _add._Amphur.AMPHUR_ID       = int.Parse(dt.Rows[0]["Add_Amphur"].ToString());
                        _add._Amphur.AMPHUR_NAME     = dt.Rows[0]["AMPHUR_NAME"].ToString();
                        _add._Province.PROVINCE_ID   = int.Parse(dt.Rows[0]["Add_Province"].ToString());
                        _add._Province.PROVINCE_NAME = dt.Rows[0]["PROVINCE_NAME"].ToString();
                        _add._Postel.Postel_Code     = dt.Rows[0]["Add_Postel"].ToString();
                        this._AddressList.Add(1, _add);

                        if (_SendAdd == "N")
                        {
                            _AddressList._Address _Send = new _AddressList._Address();
                            _Send.Address = dt.Rows[0]["SendAddress"].ToString();
                            if (dt.Rows[0]["SendAdd_Moo"].ToString() != string.Empty)
                            {
                                _Send.Add_Moo = int.Parse(dt.Rows[0]["SendAdd_Moo"].ToString());
                            }
                            else
                            {
                                _Send.Add_Moo = 0;
                            }

                            _Send.Add_HomeName = dt.Rows[0]["SendAdd_HomeName"].ToString();
                            _Send.Add_Road     = dt.Rows[0]["SendAdd_Road"].ToString();
                            _Send.Add_Soi      = dt.Rows[0]["SendAdd_Soi"].ToString();

                            _Send._District.DISTRICT_ID   = int.Parse(dt.Rows[0]["SendAdd_District"].ToString());
                            _Send._District.DISTRICT_NAME = dt.Rows[0]["SendDISTRICT_NAME"].ToString();
                            _Send._Amphur.AMPHUR_ID       = int.Parse(dt.Rows[0]["SendAdd_Amphur"].ToString());
                            _Send._Amphur.AMPHUR_NAME     = dt.Rows[0]["SendAMPHUR_NAME"].ToString();
                            _Send._Province.PROVINCE_ID   = int.Parse(dt.Rows[0]["SendAdd_Province"].ToString());
                            _Send._Province.PROVINCE_NAME = dt.Rows[0]["SendPROVINCE_NAME"].ToString();
                            _Send._Postel.Postel_Code     = dt.Rows[0]["SendAdd_Postel"].ToString();
                            this._SentAddressList.Add(1, _Send);
                        }
                    }

                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #30
0
        public void Select(int num, string MCNumber, int empid)
        {
            CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection);

            try
            {
                try
                {
                    CSQLParameterList plist = new CSQLParameterList();
                    plist.Add("@num", DbType.Int32, num, ParameterDirection.Input);
                    plist.Add("@MC_Number", DbType.String, MCNumber, ParameterDirection.Input);
                    plist.Add("@empid", DbType.Int32, empid, ParameterDirection.Input);
                    CSQLDataAdepterList adlist  = new CSQLDataAdepterList();
                    CSQLStatementValue  csvUser = new CSQLStatementValue(this._statement, plist, NoomLibrary.StatementType.Select);
                    adlist.Add(csvUser);
                    cstate.Open();
                    DataTable dt = (DataTable)cstate.Execute(adlist);;

                    if (dt.Rows.Count > 0)
                    {
                        this._Customer.Name    = dt.Rows[0]["Name"].ToString();
                        this._Customer.Surname = dt.Rows[0]["SurName"].ToString();
                        if (dt.Rows[0]["Birthday"].ToString() != string.Empty)
                        {
                            this._Customer.Birthday = DateTime.Parse(dt.Rows[0]["Birthday"].ToString());
                        }
                        this._Customer.IDCard          = dt.Rows[0]["IDCard"].ToString();
                        this._Customer.Tel_Mobile1     = dt.Rows[0]["CusTel"].ToString();
                        this._Customer.Career_Remark   = dt.Rows[0]["Career"].ToString();
                        this._Customer.CusType         = dt.Rows[0]["CustomerType"].ToString();
                        this._Customer.CorporationCode = dt.Rows[0]["CorporationCode"].ToString();

                        this._Address.Address = dt.Rows[0]["Address"].ToString();
                        this._Address._District.DISTRICT_ID   = int.Parse(dt.Rows[0]["District"].ToString());
                        this._Address._District.DISTRICT_NAME = dt.Rows[0]["DISTRICT_NAME"].ToString();
                        this._Address._Amphur.AMPHUR_ID       = int.Parse(dt.Rows[0]["Amphur"].ToString());
                        this._Address._Amphur.AMPHUR_NAME     = dt.Rows[0]["AMPHUR_NAME"].ToString();
                        this._Address._Province.PROVINCE_ID   = int.Parse(dt.Rows[0]["Province"].ToString());
                        this._Address._Province.PROVINCE_NAME = dt.Rows[0]["PROVINCE_NAME"].ToString();
                        this._Address._Postel.Postel_Code     = dt.Rows[0]["Postel"].ToString();

                        this._Purchase.EmpID = int.Parse(dt.Rows[0]["EmpID"].ToString());
                        if (dt.Rows[0]["OutCar_Date"].ToString() != string.Empty)
                        {
                            this._Purchase.Purchase_Date = DateTime.Parse(dt.Rows[0]["OutCar_Date"].ToString());
                        }
                        this._Purchase.SaleName             = dt.Rows[0]["SaleName"].ToString();
                        this._Purchase.BookID               = int.Parse(dt.Rows[0]["BookID"].ToString());
                        this._Purchase.BookNo               = dt.Rows[0]["BookNo"].ToString();
                        this._Purchase.ProspectNo           = dt.Rows[0]["ProspectNo"].ToString();
                        this._Purchase._Company.Companycode = dt.Rows[0]["BCode_Name"].ToString();
                        this._Purchase.MCNumber             = dt.Rows[0]["MCNumber"].ToString();
                        this._Purchase.TruckNumber          = dt.Rows[0]["TruckNumber"].ToString();
                        this._Purchase.MCode       = dt.Rows[0]["MCode"].ToString();
                        this._Purchase.MName       = dt.Rows[0]["MName"].ToString();
                        this._Purchase.MSaleCode   = dt.Rows[0]["MSaleCode"].ToString();
                        this._Purchase.CCode       = dt.Rows[0]["CCode"].ToString();
                        this._Purchase.CName       = dt.Rows[0]["CName"].ToString();
                        this._Purchase.CarPrice    = decimal.Parse(dt.Rows[0]["CarPrice"].ToString());
                        this._Purchase.StatusCE    = dt.Rows[0]["StatusCE"].ToString();
                        this._Purchase.CE_Brand    = dt.Rows[0]["CE_Brand"].ToString();
                        this._Purchase.CE_Model    = dt.Rows[0]["CE_Model"].ToString();
                        this._Purchase.CE_Year     = dt.Rows[0]["CE_Year"].ToString();
                        this._Purchase.CE_Price    = decimal.Parse(dt.Rows[0]["CE_Price"].ToString());
                        this._Purchase.Buy_Type    = dt.Rows[0]["Buy_Type"].ToString();
                        this._Purchase._Finance.ID = int.Parse(dt.Rows[0]["Finance"].ToString());
                        this._Purchase.PayDown     = decimal.Parse(dt.Rows[0]["PayDown"].ToString());
                        this._Purchase.DepositNo   = dt.Rows[0]["DepositNo"].ToString();
                        if (dt.Rows[0]["DepositDate"].ToString() != string.Empty)
                        {
                            this._Purchase.DepositDate = DateTime.Parse(dt.Rows[0]["DepositDate"].ToString());
                        }
                        this._Purchase.DepositPrice = decimal.Parse(dt.Rows[0]["DepositPrice"].ToString());
                    }
                    cstate.Commit();
                }
                catch (SqlException)
                {
                    cstate.Rollback();
                    throw;
                }
                finally
                {
                    cstate.Close();
                }
            }
            catch (Exception)
            {
                throw;
            }
        }