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()); _Accessories _SetAcc = new _Accessories(); _SetAcc.ID = id; _SetAcc.Name = item["Name"].ToString(); this.Add(id, _SetAcc); } cstate.Commit(); } catch (SqlException) { cstate.Rollback(); throw; } finally { cstate.Close(); } } catch (Exception) { throw; } return(result); }
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); }
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); }
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); }
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; } }
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; } }
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; } }
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; } }
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); }
public void editOrder(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.Int32, 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(); } }
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; } }
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; } }
public object Select(string Username, string Password) { object result = null; CStatementList cstate = new CStatementList(_SQLConnection.CSQLConnection); try { try { CSQLParameterList plist = new CSQLParameterList(); 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(); result = cstate.Execute(adlist); DataTable dt = (DataTable)result; foreach (DataRow item in dt.Rows) { int ID = int.Parse(item["ID"].ToString()); string _Username = item["Username"].ToString(); string Pasword = item["Password"].ToString(); string FullName = item["FullName"].ToString(); int EmpID = int.Parse(item["EmpID"].ToString()); int UserType = int.Parse(item["UserType"].ToString()); string TypeName = item["TypeName"].ToString(); string NickName = item["NickName"].ToString(); string Company = item["Company"].ToString(); string Branch = item["Branch"].ToString(); Tb_User _u = new Tb_User(); _u.ID = ID; _u.Username = _Username; _u.Password = Password; _u.FullName = FullName; _u.EmpID = EmpID; _u.UserType = UserType; _u.TypeName = TypeName; _u.NickName = NickName; _u.Company = Company; _u.Branch = Branch; this.Add(1, _u); } cstate.Commit(); } catch (SqlException) { cstate.Rollback(); throw; } finally { cstate.Close(); } } catch (Exception) { throw; } return(result); }