public static void UpdatePrice(string data, string price, string roomType) { string connectionString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; var giorno = DateTime.Parse(data); if (!string.IsNullOrEmpty(price)) { if (price.Contains("€")) { price = price.Split('€')[0]; } switch (roomType) { case "camera": DataBaseUtilities.InsertCameraMatrimonialeAvailability(connectionString, giorno, null, long.Parse(price), null); break; case "app1": DataBaseUtilities.InsertApaprtamento1Availability(connectionString, giorno, null, long.Parse(price), null); break; case "app2": DataBaseUtilities.InsertAppartamento2Availability(connectionString, giorno, null, long.Parse(price), null); break; case "Tripla": DataBaseUtilities.InsertCameraTriplaAvailability(connectionString, giorno, null, long.Parse(price), null); break; case "Quadrupla": DataBaseUtilities.InsertCameraQuadruplaAvailability(connectionString, giorno, null, long.Parse(price), null); break; } } }
private void btn_enter_Click(object sender, EventArgs e) { if (tb_barcode.Text == "請輸入商品條碼" && tb_GDNAME.Text == "請輸入商品名稱" && tb_domManufName.Text == "請輸入廠商名稱") { AutoClosingMessageBox.Show("必須輸入查詢條件"); return; } fromTable = "hypos_GOODSLST hg, HyLicence as hl"; type = ""; if (!hasSelectedCommodity()) { btn_pageLeft.Visible = true; btn_pageRight.Visible = true; status = "hg.status='U'"; string text = "".Equals(type) ? status : (type + " and " + status); if (!(tb_barcode.Text == "請輸入商品條碼") && !tb_barcode.Text.Equals("")) { text = text + " and hg.barcode = '" + tb_barcode.Text + "'"; } if (!(tb_GDNAME.Text == "請輸入商品名稱") && !tb_GDNAME.Text.Equals("")) { text = text + " and hg.GDNAME LIKE '%" + tb_GDNAME.Text + "%'"; } if (!(tb_domManufName.Text == "請輸入廠商名稱") && !tb_domManufName.Text.Equals("")) { text = text + " and hl.domManufName LIKE '%" + tb_domManufName.Text + "%'"; } dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, selectString, fromTable, text, orderByString, null, null, CommandOperationType.ExecuteReaderReturnDataTable); changePage(1); } }
private void frmEditUser_Load(object sender, EventArgs e) { cb_status.Items.Add(new ComboboxItem("正常", 0)); cb_status.Items.Add(new ComboboxItem("停用", 1)); cb_status.SelectedIndex = 0; cb_type.Items.Add(new ComboboxItem("管理者", 0)); cb_type.Items.Add(new ComboboxItem("使用者", 1)); cb_type.SelectedIndex = 1; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "hypos_User", "Account = {0}", "", null, new string[1] { _account }, CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count > 0) { l_account.Text = dataTable.Rows[0]["Account"].ToString(); tb_password.Text = dataTable.Rows[0]["Password"].ToString(); tb_Repassword.Text = dataTable.Rows[0]["Password"].ToString(); tb_Name.Text = dataTable.Rows[0]["Name"].ToString(); tb_email.Text = dataTable.Rows[0]["EMail"].ToString(); cb_status.SelectedIndex = int.Parse(dataTable.Rows[0]["Status"].ToString()); cb_type.SelectedIndex = int.Parse(dataTable.Rows[0]["Type"].ToString()); if ("001".Equals(l_account.Text)) { cb_type.Enabled = false; cb_status.Enabled = false; } } else { AutoClosingMessageBox.Show("使用者錯誤!"); Close(); } }
public frmChooseVendor(frmNewDeliveryOrder frmD) : base("出貨作業") { this.frmD = frmD; InitializeComponent(); label5.Text = " 最近出貨廠商"; ucVendorInfo = new ucVendorInfo[6] { ucVendorInfo1, ucVendorInfo2, ucVendorInfo3, ucVendorInfo4, ucVendorInfo5, ucVendorInfo6 }; ucVendorInfo[] array = ucVendorInfo; for (int i = 0; i < array.Length; i++) { array[i].Visible = false; } try { string sql = "SELECT s.*, (select d.DeliveryDate from hypos_DeliveryGoods_Master as d where s.SupplierNo=d.vendorNo order by DeliveryDate desc) as DeliveryDate FROM hypos_Supplier as s where DeliveryDate <> '' order by DeliveryDate desc"; dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteReaderReturnDataTable); changepage(1); } catch (Exception) { } }
public void MaekDeleteData() { string sql = " select distinct * from HyTempfrmDownLoadReceive where storedId !='' and shipOrReturn = 'K' and strBARCODE = '" + l_GDSNO.Text.Trim() + "'"; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, new string[0], CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count <= 0) { return; } try { for (int i = 0; i < dataTable.Rows.Count; i++) { string text = dataTable.Rows[i]["recordId"].ToString(); DataBaseUtilities.DBOperation(Program.ConnectionString, " UPDATE HyShipData_sub SET LogicDel = 'Y' WHERE recordId = {0} and shipOrReturn = 'K' ", new string[1] { text }, CommandOperationType.ExecuteNonQuery); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public Commodity_barcode(List <string> BarcodeList, int pageRecordCount) { InitializeComponent(); if (!Directory.Exists("TempBarCode")) { Directory.CreateDirectory("TempBarCode"); } _pageRecordCount = pageRecordCount; _BarcodeList = BarcodeList; _ExePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string sql = "SELECT BarcodeListType, BarcodeListPrinterName FROM hypos_PrinterManage "; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteReaderReturnDataTable); _printerType = dataTable.Rows[0]["BarcodeListType"].ToString(); _printerName = dataTable.Rows[0]["BarcodeListPrinterName"].ToString(); for (int i = 0; i < _BarcodeList.Count; i++) { string text = _BarcodeList[i].Trim(); string str = text + ".gif"; string filename = _ExePath + "\\TempBarCode\\" + str; Barcode barcode = new Barcode(); barcode.IncludeLabel = true; barcode.LabelFont = new Font("Verdana", 8f); barcode.Width = 156; barcode.Height = 63; barcode.Encode(TYPE.CODE128, text, barcode.Width, barcode.Height).Save(filename, ImageFormat.Gif); } }
private DataTable getData() { DataTable dataTable = new DataTable(); string sql = "SELECT * FROM VaccineData"; return((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteReaderReturnDataTable)); }
private DataTable getMainSellList() { return((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "items,itemstotal,sum,sumDiscount,cash,Credit", "hypos_main_sell", "sellNo={0}", "", null, new string[1] { _sellNo }, CommandOperationType.ExecuteReaderReturnDataTable)); }
private void frmLogin_Load(object sender, EventArgs e) { string text = ""; string[] array = new string[10] { "Q", "P", "E", "S", "T", "B", "A", "P", "H", "I" }; char[] array2 = (DateTime.Now.Year + DateTime.Now.Month.ToString().PadLeft(2, '0') + DateTime.Now.Day.ToString().PadLeft(2, '0')).ToCharArray(); foreach (char c in array2) { text += array[int.Parse(c.ToString())]; } DataBaseUtilities.DBOperation(Program.ConnectionString, "UPDATE hypos_User set Password ={0} WHERE Account = 'hywebAdmin'", new string[1] { text }, CommandOperationType.ExecuteNonQuery); Bitmap success = Resources.success; Bitmap failed = Resources.failed; }
private DataTable getMainSellList() { return((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "items,itemstotal,CurSum,sumDiscount,changcount,DeliveryDate,DeliveryCustomNo", "hypos_DeliveryGoods_Master", "DeliveryNo={0}", "", null, new string[1] { _DeliveryNo }, CommandOperationType.ExecuteReaderReturnDataTable)); }
private string getVendorAddress() { string result = ""; DataTable memberList = getMemberList(); if (memberList.Rows.Count > 0) { string str = string.IsNullOrEmpty(memberList.Rows[0]["CityNo"].ToString()) ? "''" : memberList.Rows[0]["CityNo"].ToString(); string str2 = string.IsNullOrEmpty(memberList.Rows[0]["Zipcode"].ToString()) ? "''" : memberList.Rows[0]["Zipcode"].ToString(); string text = string.IsNullOrEmpty(memberList.Rows[0]["Address"].ToString()) ? "''" : memberList.Rows[0]["Address"].ToString(); string sql = "SELECT city FROM ADDRCITY where cityno =" + str + " limit 1"; string text2 = Convert.ToString(DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteScalar)); string sql2 = "SELECT area FROM ADDRAREA where zipcode =" + str2 + " limit 1"; string text3 = Convert.ToString(DataBaseUtilities.DBOperation(Program.ConnectionString, sql2, null, CommandOperationType.ExecuteScalar)); if ("-1".Equals(text2)) { text2 = ""; } if ("-1".Equals(text3)) { text3 = ""; } if ("''".Equals(text)) { text = ""; } result = text2 + text3 + text; } return(result); }
private void frmInitSysParam_Load(object sender, EventArgs e) { btnUploadSysSN.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, "SELECT * FROM hypos_RegisterLicense order by CreateDate desc limit 1 ", null, CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count > 0) { txtLicenseCode.Text = dataTable.Rows[0]["LicenseCode"].ToString(); txtShopName.Text = dataTable.Rows[0]["ShopName"].ToString(); string text = dataTable.Rows[0]["isApproved"].ToString(); if ("N".Equals(text)) { l_info1.Text = "申請失敗,請再重新申請一次"; RegisterCode = ""; } else if (text == null || "".Equals(text)) { btnSubmit.Enabled = true; btnUploadSysSN.Enabled = false; btnReset.Enabled = false; txtLicenseCode.Enabled = false; txtShopName.Enabled = false; btnSubmit.BackColor = Color.FromArgb(0, 153, 204); RegisterCode = dataTable.Rows[0]["RegisterCode"].ToString(); } } else if (!Program.IsDeployClickOnce) { txtLicenseCode.Text = "N00019"; txtShopName.Text = "興農股份有限公司臺東營業所"; } }
private void btn_mode_1_Click(object sender, EventArgs e) { if (MessageBox.Show("轉入功能只能在初次安裝時進行一次,若放棄轉入之後無法進行補轉入,確定放棄轉入?", "", MessageBoxButtons.YesNo, MessageBoxIcon.Question) != DialogResult.Yes) { return; } try { DataBaseUtilities.DBOperation(Program.ConnectionString, "UPDATE hypos_SysParam SET IsDataTransfer = 'Y'", null, CommandOperationType.ExecuteNonQuery); if (!Directory.Exists("C:\\Hypos")) { Directory.CreateDirectory("C:\\Hypos"); } using (FileStream stream = new FileStream("C:\\Hypos\\conn_log.txt", FileMode.Create, FileAccess.Write)) { using (StreamWriter streamWriter = new StreamWriter(stream, Encoding.Unicode)) { streamWriter.WriteLine("2"); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { Close(); } }
public static void UpdateRestrictione(string data, string restriction, string roomType) { string connectionString = System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]; var giorno = DateTime.Parse(data); if (!string.IsNullOrEmpty(restriction)) { switch (roomType) { case "camera": DataBaseUtilities.InsertCameraMatrimonialeAvailability(connectionString, giorno, null, null, int.Parse(restriction)); break; case "app1": DataBaseUtilities.InsertApaprtamento1Availability(connectionString, giorno, null, null, int.Parse(restriction)); break; case "app2": DataBaseUtilities.InsertAppartamento2Availability(connectionString, giorno, null, null, int.Parse(restriction)); break; case "Tripla": DataBaseUtilities.InsertCameraTriplaAvailability(connectionString, giorno, null, null, int.Parse(restriction)); break; case "Quadrupla": DataBaseUtilities.InsertCameraQuadruplaAvailability(connectionString, giorno, null, null, int.Parse(restriction)); break; } } }
private string divPage() { string text = ""; string text2 = "GDSNO in ("; for (int i = 0; i < _BarcodeList.Count; i++) { text2 = text2 + "{" + i + "},"; } text2 = text2.Substring(0, text2.Length - 1) + ")"; string strSelectField = "domManufId,GDName,brandName,CName,contents,spec,capacity,GDSNO,formCode"; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, strSelectField, "hypos_GOODSLST", text2, "", null, _BarcodeList.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count > 0 && (_pageRecordCount == 3 || _pageRecordCount == 6 || _pageRecordCount == 12)) { int num = _BarcodeList.Count / _pageRecordCount; num = ((_BarcodeList.Count <= _pageRecordCount) ? 1 : (num + 1)); for (int j = 0; j < dataTable.Rows.Count; j++) { int num2 = (j + 1) / _pageRecordCount; if ((j + 1) % _pageRecordCount != 0 || j < _pageRecordCount - 1) { num2++; } text = tableConent(text, _pageRecordCount, dataTable, j, num2, num); } text += "</div>"; } return(text); }
private void displayTempMember() { if (tableLayoutPanel1.HasChildren) { tableLayoutPanel1.Controls.Clear(); } if (Program.membersTemp.Count != 0) { string text = "VipNo in ("; for (int i = 0; i < Program.membersTemp.Count; i++) { text = text + "{" + i + "},"; } text = text.Substring(0, text.Length - 1) + ")"; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "hypos_CUST_RTL", text, "", null, Program.membersTemp.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count > 0) { tableLayoutPanel1.RowCount = Program.membersTemp.Count; for (int j = 0; j < dataTable.Rows.Count; j++) { CheckBox checkBox = new CheckBox(); checkBox.Dock = DockStyle.Fill; checkBox.Name = dataTable.Rows[j]["VipNo"].ToString(); checkBox.Text = dataTable.Rows[j]["VipNo"].ToString(); Label label = new Label(); label.Text = dataTable.Rows[j]["Name"].ToString(); label.BackColor = Color.Transparent; label.Anchor = AnchorStyles.None; Label label2 = new Label(); label2.Text = dataTable.Rows[j]["Mobile"].ToString(); label2.BackColor = Color.Transparent; label2.Anchor = AnchorStyles.None; Label label3 = new Label(); label3.Text = dataTable.Rows[j]["CompanyIdNo"].ToString(); label3.BackColor = Color.Transparent; label3.Anchor = AnchorStyles.None; tableLayoutPanel1.Controls.Add(checkBox, 0, j); tableLayoutPanel1.Controls.Add(label, 1, j); tableLayoutPanel1.Controls.Add(label2, 2, j); tableLayoutPanel1.Controls.Add(label3, 3, j); tableLayoutPanel1.RowStyles.Add(new RowStyle(SizeType.Absolute, 61f)); } if (Program.membersTemp.Count > 6) { tableLayoutPanel1.AutoScroll = true; tableLayoutPanel1.Padding = new Padding(0, 0, 10, 1); } else { tableLayoutPanel1.AutoScroll = false; tableLayoutPanel1.Padding = new Padding(0, 0, 1, 1); } } } else { MessageBox.Show("已無暫存會員資料"); Close(); } }
private string divPagePRO() { string text = ""; int count = _cropList.Count; int num = 3; string sql = "SELECT GDSNO,GDName,domManufId,brandName,CName,contents,spec,capacity FROM hypos_GOODSLST where GDSNO='" + _barCode + "'"; DataTable dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteReaderReturnDataTable); if (count > 0) { int num2 = count / num; num2 = ((count <= num) ? 1 : (num2 + 1)); for (int i = 0; i < count; i++) { int num3 = (i + 1) / num; if ((i + 1) % num != 0 || i < num - 1) { num3++; } text = tableConentPRO(dt, text, num, i, num3, num2); } text += "</div>"; } return(text); }
private void btnUploadSysSN_Click(object sender, EventArgs e) { frmUploadSysSN frmUploadSysSN = new frmUploadSysSN(); try { if (frmUploadSysSN.ShowDialog(this) == DialogResult.OK) { Program.UploadedSysSN = ((Program.UploadedSysSN == UploadSySNType.未上傳序號) ? UploadSySNType.已上傳序號 : UploadSySNType.序號改變已上傳); btnUploadSysSN.Enabled = false; string[,] strFieldArray = new string[1, 2] { { "UploadedSysSN", Convert.ToInt32(Program.UploadedSysSN).ToString() } }; if (Convert.ToInt32(DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Update, "", "SysParam", "1=1", "", strFieldArray, null, CommandOperationType.ExecuteNonQuery)) == 0) { DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Insert, "", "SysParam", "", "", strFieldArray, null, CommandOperationType.ExecuteNonQuery); } AutoGetSN(); } } catch (Exception) { } frmUploadSysSN.Dispose(); }
private void btn_week_Click(object sender, EventArgs e) { DateTime now = DateTime.Now; int num = (int)now.DayOfWeek; if (num == 0) { num = 7; } int num2 = 7 - num; int num3 = num - 1; DateTime dateTime = now.AddDays(-num3); DateTime dateTime2 = now.AddDays(num2); string text = new DateTime(dateTime.Year, dateTime.Month, dateTime.Day, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss"); string text2 = new DateTime(dateTime2.Year, dateTime2.Month, dateTime2.Day, 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss"); status = "hms.sellTime >= '" + text + "' and hms.sellTime <= '" + text2 + "'"; dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "hms.sellNo,hms.sellTime,hms.memberId,hms.items,hcr.Name,hcr.Mobile ,hcr.IdNo,hcr.CompanyIdNo,hms.cash,hms.Credit,hms.sum ", "hypos_main_sell as hms left outer join hypos_CUST_RTL as hcr on hms.memberId= hcr.VipNo", status, "", null, null, CommandOperationType.ExecuteReaderReturnDataTable); changePage(1); btn_statusAll.ForeColor = Color.FromArgb(247, 106, 45); btn_statusAll.BackColor = Color.White; btn_today.ForeColor = Color.FromArgb(247, 106, 45); btn_today.BackColor = Color.White; btn_week.ForeColor = Color.White; btn_week.BackColor = Color.FromArgb(247, 106, 45); btn_month.ForeColor = Color.FromArgb(247, 106, 45); btn_month.BackColor = Color.White; btn_lastMonth.ForeColor = Color.FromArgb(247, 106, 45); btn_lastMonth.BackColor = Color.White; }
private void btnSubmit_Click(object sender, EventArgs e) { if (txtValadationCode.Text == Program.ValadationCode) { MessageBox.Show("授權碼正確!"); string[,] strFieldArray = new string[3, 2] { { "SysSerialNo", Program.SysSerialNo }, { "UploadedSysSN", Convert.ToInt32(UploadSySNType.已上傳序號).ToString() }, { "ProducerName", "" } }; if (Convert.ToInt32(DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Update, "", "SysParam", "1=1", "", strFieldArray, null, CommandOperationType.ExecuteNonQuery)) == 0) { DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Insert, "", "SysParam", "", "", strFieldArray, null, CommandOperationType.ExecuteNonQuery); } Program.WriteCRC(); Program.ProducerName = ""; ShowMainDialog(); } else { MessageBox.Show("授權碼錯誤"); } }
private void btn_Query_Click(object sender, EventArgs e) { DataTable dataTable = new DataTable(); string str = "SELECT (select count(*) from Record b where a.id >= b.id and LogicDel=0) as '序號', CaseName as '姓名', RocID as '身分證號', Birthday as '出生日期',InoculationDate as '接種日期',VaccineCode as '疫苗名稱',VaccineNo as '劑別/型', VaccBatchNo as '疫苗批號', ParentRocID as '父或母身分證號',BirthSeq as '同胎次序',Tel as '電話', Address as '通訊地址', ExportedDate as '匯出日期' from Record as a where LogicDel=0 "; if (tb_CaseName.Text.Trim() != "") { str = str + "and CaseName='" + tb_CaseName.Text.Trim() + "' "; } if (tb_RocID.Text.Trim() != "") { str = str + "and RocID='" + tb_RocID.Text.Trim() + "' "; } if (tb_ParentRocID.Text.Trim() != "") { str = str + "and ParentRocID='" + tb_ParentRocID.Text.Trim() + "' "; } if (rb_AllData.Checked) { str = str + "and (ExportedDate is null or ExportedDate='" + Utility.ToRocDateString(DateTime.Now) + "')"; } else if (rb_NoExport.Checked) { str += "and ExportedDate is null "; } str += "ORDER BY 序號 ASC;"; dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, str, null, CommandOperationType.ExecuteReaderReturnDataTable); dv_Data.DataSource = dataTable; lb_DataCnt.Text = "查詢結果:共 " + dataTable.Rows.Count + " 筆資料"; }
private static string CheckShopType() { if (!NetworkInterface.GetIsNetworkAvailable()) { DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(ConnectionString, "SELECT IsRetailer, IsWholesaler FROM hypos_ShopInfoManage", null, CommandOperationType.ExecuteReaderReturnDataTable); string text = string.IsNullOrEmpty(dataTable.Rows[0]["IsRetailer"].ToString()) ? "NULL" : dataTable.Rows[0]["IsRetailer"].ToString(); string text2 = string.IsNullOrEmpty(dataTable.Rows[0]["IsWholesaler"].ToString()) ? "NULL" : dataTable.Rows[0]["IsWholesaler"].ToString(); if (text.Equals("ON") && text2.Equals("ON")) { ShopType = "0"; } else if (text.Equals("ON") && (text2.Equals("OFF") || text2.Equals("NULL"))) { ShopType = "1"; } else if ((text.Equals("OFF") || text.Equals("NULL")) && text2.Equals("ON")) { ShopType = "2"; } else { ShopType = "-1"; } } return(""); }
private void search_Click(object sender, EventArgs e) { if ((tb_SupplierIdNo.Text == "請輸入廠商統一編號" || tb_SupplierIdNo.Text.Trim() == "") && (tb_SupplierName.Text == "請輸入廠商名稱" || tb_SupplierName.Text.Trim() == "") && (tb_vendorId.Text == "請輸入廠商營業執照號碼" || tb_vendorId.Text.Trim() == "")) { AutoClosingMessageBox.Show("必須輸入查詢條件"); return; } IsRecentlyDelivery = false; string str = "SELECT * FROM hypos_Supplier WHERE 1=1 and vendorType in ('0','2') and status = 0 "; string text = ""; if (tb_SupplierIdNo.Text.Trim() != "" && tb_SupplierIdNo.Text.Trim() != "請輸入廠商統一編號") { text = text + " AND SupplierIdNo like '%" + tb_SupplierIdNo.Text.Trim() + "%' "; } if (tb_SupplierName.Text.Trim() != "" && tb_SupplierName.Text.Trim() != "請輸入廠商名稱") { text = text + " AND SupplierName like '%" + tb_SupplierName.Text.Trim() + "%' "; } if (tb_vendorId.Text.Trim() != "" && tb_vendorId.Text.Trim() != "請輸入廠商營業執照號碼") { text = text + " AND vendorId like '%" + tb_vendorId.Text.Trim() + "%' "; } dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, str + text, null, CommandOperationType.ExecuteReaderReturnDataTable); changepage(1); }
/// <summary> /// Devuelve una lista de equipos en base al parámetro de busqueda deseado /// </summary> /// <param name="parametroBusqueda">Nombre de la columna contra la cual compararemos</param> /// <param name="valorParametro">Valor que estamos buscando</param> /// <returns></returns> public ObservableCollection <Equipos> GetEquiposPorParametro(String parametroBusqueda, String valorParametro) { SqlConnection sqlConne = Conexion.GetConexion(); SqlDataReader dataReader; ObservableCollection <Equipos> listaEquipos = new ObservableCollection <Equipos>(); try { sqlConne.Open(); string selstr = "select E.*,T.Descripcion from Equipos E INNER JOIN TiposEquipos T ON T.idTipo = E.idTipo WHERE E." + parametroBusqueda + " = @valorParametro AND T.idInventario = 1"; SqlCommand cmd = new SqlCommand(selstr, sqlConne); SqlParameter param = cmd.Parameters.Add("@valorParametro", SqlDbType.NVarChar, 0); param.Value = valorParametro; dataReader = cmd.ExecuteReader(); if (dataReader.HasRows) { while (dataReader.Read()) { Equipos myEquipo = new Equipos(); myEquipo.Expediente = Convert.ToInt32(dataReader["Expediente"]); myEquipo.IdEquipo = Convert.ToInt32(dataReader["idEquipo"]); myEquipo.ScEquipo = dataReader["SC_Equipo"].ToString(); myEquipo.ScPrincipal = DataBaseUtilities.VerifyDbNullForStrings(dataReader, "SC_Principal"); myEquipo.IdTipo = Convert.ToInt32(dataReader["idTipo"]); myEquipo.TipoEquipo = dataReader["Descripcion"].ToString(); myEquipo.Marca = DataBaseUtilities.VerifyDbNullForStrings(dataReader, "Marca"); myEquipo.Modelo = DataBaseUtilities.VerifyDbNullForStrings(dataReader, "Modelo"); myEquipo.NoSerie = DataBaseUtilities.VerifyDbNullForStrings(dataReader, "NoSerie"); myEquipo.Observaciones = DataBaseUtilities.VerifyDbNullForStrings(dataReader, "Observaciones"); myEquipo.Estado = DataBaseUtilities.VerifyDbNullForStrings(dataReader, "Estado"); myEquipo.FechaAlta = DateTimeUtilities.GetDateFromReader(dataReader, "Alta"); myEquipo.FechaModificacion = DateTimeUtilities.GetDateFromReader(dataReader, "Modificacion"); listaEquipos.Add(myEquipo); } } dataReader.Close(); selstr = null; } catch (SqlException sql) { MessageBox.Show("Error ({0}) : {1}" + sql.Source + sql.Message, "Error Interno"); } catch (Exception ex) { MessageBox.Show("Error ({0}) : {1}" + ex.Source + ex.Message, "Error Interno"); } finally { sqlConne.Close(); } return(listaEquipos); }
private void dialogDeliveryPriceLog_Load(object sender, EventArgs e) { dataGridView2.Rows.Clear(); DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "hypos_DeliveryPrice_log", "GDSNO = {0}", " editDate desc", null, new string[1] { _GDSNO }, CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count <= 0) { return; } for (int i = 0; i < dataTable.Rows.Count; i++) { string text = ""; string a = dataTable.Rows[i]["status"].ToString(); if (!(a == "Y")) { if (a == "N") { text = ""; } } else { text = "使用中"; } dataGridView2.Rows.Insert(i, dataTable.Rows[i]["editDate"].ToString(), dataTable.Rows[i]["price"].ToString(), dataTable.Rows[i]["Account"].ToString(), text); } }
private void frmInventoryMangement_Load(object sender, EventArgs e) { dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, selectStr, "hypos_DeliveryGoods_Master a, hypos_Supplier b", getWhereStr(), orderByStr, null, null, CommandOperationType.ExecuteReaderReturnDataTable); pageTotal = (int)Math.Ceiling((double)dt.Rows.Count / (double)pageSize); changePage(1); btn_statusAll_Click(sender, e); }
public dialogChooseCommodity(List <string> lst) { lst_commoditylist.Clear(); lst_commoditylist = lst; InitializeComponent(); tb_barcode.Select(); ucCommoditys = new ucCommodityInfo[8] { uC_Commodity1, uC_Commodity2, uC_Commodity3, uC_Commodity4, uC_Commodity5, uC_Commodity6, uC_Commodity7, uC_Commodity8 }; ucCommodityInfo[] array = ucCommoditys; for (int i = 0; i < array.Length; i++) { array[i].OnClickCommodity += new EventHandler(CommodityChecked); } fromTable = "hypos_GOODSLST hg, HyLicence as hl"; type = "hg.CLA1NO ='0302' and hg.ISWS ='Y' and hg.licType = hl.licType and hg.domManufId = hl.licNo"; if (!hasSelectedCommodity()) { btn_pageLeft.Visible = true; btn_pageRight.Visible = true; status = "hg.status='U'"; string strWhereClause = "".Equals(type) ? status : (type + " and " + status); dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, selectString, fromTable, strWhereClause, orderByString, null, null, CommandOperationType.ExecuteReaderReturnDataTable); changePage(1); } }
private void btn_complete_Click(object sender, EventArgs e) { if ("".Equals(tb_vendorName.Text) || "".Equals(tb_vendorId.Text)) { AutoClosingMessageBox.Show("請先驗證廠商營業資訊"); return; } string[,] strFieldArray = new string[3, 2] { { "vendorId", tb_vendorId.Text }, { "vendorName", tb_vendorName.Text }, { "EditDate", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") } }; DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Update, "", "hypos_Supplier", "SupplierNo ={0}", "", strFieldArray, new string[1] { tb_supplierNo.Text }, CommandOperationType.ExecuteNonQuery); _fEI.set_vendorINFO(tb_vendorId.Text, tb_vendorName.Text); Close(); }
public void infolistCellForNewDeliveryOrder(object sender, EventArgs e) { CommodityInfoforSearch commodityInfoforSearch = sender as CommodityInfoforSearch; string strTableName = "hypos_GOODSLST as hg left outer join HyLicence as hl on hg.licType =hl.licType and hg.domManufId =hl.licNo"; string strWhereClause = "hg.GDSNO ={0} AND ((hg.ISWS ='Y' and hg.CLA1NO ='0302' and hg.licType = hl.licType and hg.domManufId = hl.licNo) OR (hg.ISWS ='N' and hg.CLA1NO ='0302') OR hg.CLA1NO ='0303' OR hg.CLA1NO ='0305' OR hg.CLA1NO ='0308') AND (hl.isDelete='N' or hl.isDelete is null) "; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "hg.inventory,hg.GDSNO,hg.spec,hg.capacity,hg.GDName,hg.formCode,hg.CName,hg.contents,hg.brandName,hg.CLA1NO,hg.ISWS", strTableName, strWhereClause, "", null, new string[1] { commodityInfoforSearch.barcode }, CommandOperationType.ExecuteReaderReturnDataTable); DialogResult dialogResult = DialogResult.None; if (dataTable.Rows.Count > 0 && "0302".Equals(dataTable.Rows[0]["CLA1NO"].ToString()) && "Y".Equals(dataTable.Rows[0]["ISWS"].ToString())) { dialogResult = new dialogSetBatchNoAndMFGdate2(frmD, commodityInfoforSearch.barcode).ShowDialog(); } else { frmD.addOnecommodity(sender, e, commodityInfoforSearch.barcode); frmD.Show(); Close(); } if (dialogResult == DialogResult.Yes) { frmD.addOnecommodity(sender, e, commodityInfoforSearch.barcode); frmD.Show(); Close(); } }
private string divPage() { string text = ""; string text2 = "VipNo in ("; for (int i = 0; i < _vipNoList.Count; i++) { text2 = text2 + "{" + i + "},"; } text2 = text2.Substring(0, text2.Length - 1) + ")"; DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "hypos_CUST_RTL", text2, "", null, _vipNoList.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable); if (dataTable.Rows.Count > 0 && (_pageRecordCount == 3 || _pageRecordCount == 6 || _pageRecordCount == 12)) { int num = _vipNoList.Count / _pageRecordCount; num = ((_vipNoList.Count <= _pageRecordCount) ? 1 : (num + 1)); for (int j = 0; j < dataTable.Rows.Count; j++) { int num2 = (j + 1) / _pageRecordCount; if ((j + 1) % _pageRecordCount != 0 || j < _pageRecordCount - 1) { num2++; } text = tableConent(text, _pageRecordCount, dataTable, j, num2, num); } text += "</div>"; } return(text); }