示例#1
0
        private static string GetDBHardDiskSerialNo()
        {
            string sql  = "SELECT HardDiskSerialNo FROM hypos_RegisterLicense where isApproved = 'Y' order by CreateDate desc limit 1";
            string text = Convert.ToString(DataBaseUtilities.DBOperation(ConnectionString, sql, null, CommandOperationType.ExecuteScalar));

            if ("-1".Equals(text))
            {
                return("");
            }
            return(text);
        }
示例#2
0
        private void loaddata()
        {
            string strWhereClause = " hypos_user_pair.barcode = '" + barcodeNum + "' and hypos_user_pair.cropId = HyCrop.code and hypos_user_pair.pestId = HyBlight.code  ";

            dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "HyBlight.name as Blname,HyCrop.name as cropname,hypos_user_pair.cropId as hcropid,hypos_user_pair.pestId as hpestId ", "hypos_user_pair,HyBlight,HyCrop", strWhereClause, "", null, null, CommandOperationType.ExecuteReaderReturnDataTable);
            foreach (DataRow row in dt.Rows)
            {
                infolist.Rows.Add(row["cropname"].ToString(), row["Blname"].ToString(), "選擇", "用藥說明", barcodeNum, row["hcropid"].ToString(), row["hpestId"].ToString());
                infolist.Rows[0].Selected = false;
            }
        }
示例#3
0
 private void btn_statusSuspend_Click(object sender, EventArgs e)
 {
     status = " status = 1 ";
     dt     = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "CreateDate,SupplierNo,SupplierName,SupplierIdNo,Status", "hypos_Supplier", getWhereString(), orderByString, null, null, CommandOperationType.ExecuteReaderReturnDataTable);
     changePage(1);
     btn_statusAll.ForeColor     = Color.FromArgb(247, 106, 45);
     btn_statusAll.BackColor     = Color.White;
     btn_statusNormal.ForeColor  = Color.FromArgb(247, 106, 45);
     btn_statusNormal.BackColor  = Color.White;
     btn_statusSuspend.ForeColor = Color.White;
     btn_statusSuspend.BackColor = Color.FromArgb(247, 106, 45);
 }
 private void btn_statusSuspend_Click(object sender, EventArgs e)
 {
     status = "'1'";
     dt     = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, selectStr, "hypos_DeliveryGoods_Master a, hypos_Supplier b", getWhereStr(), orderByStr, null, null, CommandOperationType.ExecuteReaderReturnDataTable);
     changePage(1);
     btn_statusAll.ForeColor    = Color.FromArgb(247, 106, 45);
     btn_statusAll.BackColor    = Color.White;
     btn_statusNormal.ForeColor = Color.FromArgb(247, 106, 45);
     btn_statusNormal.BackColor = Color.White;
     btn_statusCancel.ForeColor = Color.White;
     btn_statusCancel.BackColor = Color.FromArgb(247, 106, 45);
 }
        private void dialogChooseSupplier_Load(object sender, EventArgs e)
        {
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "SupplierNo,SupplierName,SupplierIdNo,Status,vendorType", "hypos_Supplier", " Status = 0 and vendorType in (0,1)", " CreateDate Desc", null, null, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count > 0)
            {
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    dataGridView1.Rows.Insert(i, dataTable.Rows[i]["SupplierNo"].ToString(), dataTable.Rows[i]["SupplierIdNo"].ToString(), dataTable.Rows[i]["SupplierName"].ToString(), "選擇");
                }
            }
        }
示例#6
0
    private void btnSubmit_Click(object sender, EventArgs e)
    {
        try
        {
            if (txtOrgID.Text.Length <= 0)
            {
                MessageBox.Show("組織代碼不得為空");
            }
            else if (!CommonUtilities.isInteger(txtOrgID.Text))
            {
                MessageBox.Show("請輸入正確組織代碼格式");
            }
            else if (NetworkInfo.IsConnectionExist(Program.WebServiceHostNameOL))
            {
                Service service = new Service();
                service.Url     = Program.OLPUrl;
                service.Timeout = 800000;
                switch (service.UploadSN(lblsysSerialNo.Text, txtOrgID.Text))
                {
                case "0":
                    MessageBox.Show("上傳成功!");
                    DataBaseUtilities.DBOperation(Program.ConnectionString, "Update SysParam set OrgID = {0}", new string[1]
                    {
                        txtOrgID.Text
                    }, CommandOperationType.ExecuteNonQuery);
                    base.DialogResult = DialogResult.OK;
                    Close();
                    break;

                case "1":
                    MessageBox.Show("上傳失敗,請輸入正確組織代碼!");
                    break;

                case "2":
                    MessageBox.Show("上傳組織代碼失敗,請稍候重試。");
                    break;

                default:
                    MessageBox.Show("上傳主機失敗,請稍候重試。");
                    break;
                }
            }
            else
            {
                MessageBox.Show("目前無法連上主機,請稍候重試。");
            }
        }
        catch (Exception)
        {
            MessageBox.Show("目前無法連上主機,請稍候重試。");
            Close();
        }
    }
示例#7
0
        private static void AutoBackupDT()
        {
            string text = DataBaseUtilities.DBOperation(ConnectionString, TableOperation.Select, "AutoBackupPath", "hypos_CommonManage", "", "", null, null, CommandOperationType.ExecuteScalar).ToString();

            if (!Directory.Exists(text))
            {
                Directory.CreateDirectory(text);
            }
            string str = "db_DT_" + DateTime.Now.ToString("yyyyMMddHHmmssfff") + ".db3";

            File.Copy(DataPath + "\\db.db3", text + "\\" + str);
        }
示例#8
0
        private DataTable getGoodsList(List <string> barCodeList)
        {
            string strSelectField = "CLA1NO, GDSNO, pesticideId, ISWS, SubsidyFertilizer";
            string text           = "GDSNO in (";

            for (int i = 0; i < barCodeList.Count; i++)
            {
                text = text + "{" + i + "},";
            }
            text = text.Substring(0, text.Length - 1) + ")";
            return((DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, strSelectField, "hypos_GOODSLST", text, "", null, barCodeList.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable));
        }
        private void CommonUtilities()
        {
            if (!Directory.Exists("TempBarCode"))
            {
                Directory.CreateDirectory("TempBarCode");
            }
            _ExePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
            string sql = "SELECT ShopName FROM hypos_RegisterLicense where isApproved = 'Y' order by CreateDate desc limit 1";

            _shopName = Convert.ToString(DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteScalar));
            string        sql2      = "SELECT barcode, num, sellingPrice, subtotal, BatchNo, MFGDate, POSBatchNo FROM hypos_DeliveryGoods_Detail where DeliveryNo='" + _DeliveryNo + "'";
            DataTable     dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql2, null, CommandOperationType.ExecuteReaderReturnDataTable);
            List <string> list      = new List <string>();

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                list.Add(dataTable.Rows[i]["barcode"].ToString());
            }
            _detailSell = dataTable;
            _detailList = list;
            string strSelectField = "GDSNO,GDName,CName,contents,brandName,spec,capacity,formCode";
            string text           = "GDSNO in (";

            for (int j = 0; j < _detailList.Count; j++)
            {
                text = text + "{" + j + "},";
            }
            text = text.Substring(0, text.Length - 1) + ")";
            DataTable dataTable2 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, strSelectField, "hypos_GOODSLST", text, "", null, _detailList.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable);
            Dictionary <string, int> dictionary = new Dictionary <string, int>();

            for (int k = 0; k < dataTable2.Rows.Count; k++)
            {
                dictionary.Add(dataTable2.Rows[k]["GDSNO"].ToString(), k);
            }
            _barCode    = dataTable2;
            _barCodeMap = dictionary;
            string    sql3       = "SELECT ReceiveType, ReceivePrinterName FROM hypos_PrinterManage ";
            DataTable dataTable3 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql3, null, CommandOperationType.ExecuteReaderReturnDataTable);

            _printerType = "A4";
            _printerName = dataTable3.Rows[0]["ReceivePrinterName"].ToString();
            string  str      = _DeliveryNo + ".gif";
            string  filename = _imagePath = _ExePath + "\\TempBarCode\\" + str;
            Barcode barcode  = new Barcode();

            barcode.IncludeLabel = true;
            barcode.LabelFont    = new Font("Verdana", 8f);
            barcode.Width        = 181;
            barcode.Height       = 54;
            barcode.Encode(TYPE.CODE128, _DeliveryNo, barcode.Width, barcode.Height).Save(filename, ImageFormat.Gif);
        }
示例#10
0
        private void button1_Click(object sender, EventArgs e)
        {
            string sql  = "SELECT SystemMode FROM hypos_SysParam";
            string text = DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteScalar).ToString();

            if ("".Equals(text))
            {
                switchForm(new frmMode());
                return;
            }
            Program.SystemMode = int.Parse(text);
            switchForm(new frmMain());
        }
 public void UpdateDeliveryMangemnetPage()
 {
     status    = "";
     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.ForeColor    = Color.White;
     btn_statusAll.BackColor    = Color.FromArgb(247, 106, 45);
     btn_statusNormal.ForeColor = Color.FromArgb(247, 106, 45);
     btn_statusNormal.BackColor = Color.White;
     btn_statusCancel.ForeColor = Color.FromArgb(247, 106, 45);
     btn_statusCancel.BackColor = Color.White;
 }
示例#12
0
        public frmNoSaleReport()
            : base("無銷售回報")
        {
            InitializeComponent();
            string sql = "SELECT RegisterCode FROM hypos_RegisterLicense where isApproved = 'Y' order by CreateDate desc limit 1";

            _RegisterCode = Convert.ToString(DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteScalar));
            string text = "";
            string str  = Uri.EscapeDataString(_RegisterCode);

            text = "https://pest.baphiq.gov.tw/BAPHIQ/wSite/upos/sale_no.jsp?applySerial=" + str + "&version=" + Program.Version;
            webBrowser1.Navigate(text);
        }
 private void btn_statusNormal_Click(object sender, EventArgs e)
 {
     status    = "'0','1'";
     dt        = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, selectStr, "hypos_PurchaseGoods_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.ForeColor    = Color.FromArgb(247, 106, 45);
     btn_statusAll.BackColor    = Color.White;
     btn_statusNormal.ForeColor = Color.White;
     btn_statusNormal.BackColor = Color.FromArgb(247, 106, 45);
     btn_statusCancel.ForeColor = Color.FromArgb(247, 106, 45);
     btn_statusCancel.BackColor = Color.White;
 }
示例#14
0
 private void btn_statusAll_Click(object sender, EventArgs e)
 {
     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", "", "", null, null, CommandOperationType.ExecuteReaderReturnDataTable);
     pageTotal = (int)Math.Ceiling((double)dt.Rows.Count / 8.0);
     changePage(1);
     btn_statusAll.ForeColor     = Color.White;
     btn_statusAll.BackColor     = Color.FromArgb(247, 106, 45);
     btn_statusNormal.ForeColor  = Color.FromArgb(247, 106, 45);
     btn_statusNormal.BackColor  = Color.White;
     btn_statusSuspend.ForeColor = Color.FromArgb(247, 106, 45);
     btn_statusSuspend.BackColor = Color.White;
     button3.ForeColor           = Color.FromArgb(247, 106, 45);
     button3.BackColor           = Color.White;
 }
示例#15
0
        private void clslit3_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 1)
            {
                string text     = clslit3["code", e.RowIndex].Value.ToString();
                string text2    = clslit3["cropId", e.RowIndex].Value.ToString();
                string text3    = clslit3["pestId", e.RowIndex].Value.ToString();
                string formCode = clslit3["formcode", e.RowIndex].Value.ToString();
                string text4    = clslit3["Contents", e.RowIndex].Value.ToString();
                new dialogMedDescription(text, text2, text3, formCode, text4).ShowDialog();
                return;
            }
            barcodelist.Clear();
            clslit4.Rows.Clear();
            string text5 = clslit3.CurrentRow.Cells["cropId"].Value.ToString();
            string text6 = clslit3.CurrentRow.Cells["pestId"].Value.ToString();
            string text7 = clslit3.CurrentRow.Cells["code"].Value.ToString();
            string text8 = clslit3.CurrentRow.Cells["formcode"].Value.ToString();
            string text9 = clslit3.CurrentRow.Cells["Contents"].Value.ToString();

            string[] strWhereParameterArray = new string[3]
            {
                text7,
                text8,
                text9
            };
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "licType,licNo,pesticideName,domManufId,domManufName", "HyLicence", "pesticideId={0} and formCode={1} and contents={2} and isDelete='N'", "licNo", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count <= 0)
            {
                return;
            }
            foreach (DataRow row in dataTable.Rows)
            {
                string[] strWhereParameterArray2 = new string[2]
                {
                    row["licNo"].ToString(),
                    row["licType"].ToString()
                };
                DataTable dataTable2 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "spec,GDSNO,capacity,GDName", "hypos_GOODSLST", "domManufId={0} and licType ={1} and status !='D' ", "barcode", null, strWhereParameterArray2, CommandOperationType.ExecuteReaderReturnDataTable);
                if (dataTable2.Rows.Count <= 0)
                {
                    continue;
                }
                foreach (DataRow row2 in dataTable2.Rows)
                {
                    clslit4.Rows.Add(row2["GDName"].ToString() + "[" + row["domManufName"].ToString() + "] \r\n" + row2["spec"].ToString() + " " + row2["capacity"].ToString(), row2["GDSNO"].ToString(), text5, text6, text7, text8, text9);
                }
            }
        }
示例#16
0
    private void dialogChooseVendors_Load(object sender, EventArgs e)
    {
        DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "SupplierNo,SupplierName,SupplierIdNo,Status", "hypos_Supplier", " Status = 0", " CreateDate Desc", null, null, CommandOperationType.ExecuteReaderReturnDataTable);

        if (dataTable.Rows.Count > 0)
        {
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                dataGridView1.Rows.Insert(i, false, dataTable.Rows[i]["SupplierIdNo"].ToString(), dataTable.Rows[i]["SupplierName"].ToString(), "選擇", dataTable.Rows[i]["SupplierNo"].ToString());
            }
        }
        tb_keyword.Focus();
        tb_keyword.SelectionStart = tb_keyword.Text.Length;
    }
示例#17
0
        private void dialogPurchaseUpdateLog_Load(object sender, EventArgs e)
        {
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "hypos_PurchaseGoods_Detail_Log l, hypos_GOODSLST g", " l.GDSNO = g.GDSNO and PurchaseNo = {0}", " updateDate Desc", null, new string[1]
            {
                _PurchaseNo
            }, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count <= 0)
            {
                return;
            }
            string text  = "";
            string text2 = "";

            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                if (string.IsNullOrEmpty(text))
                {
                    text = dataTable.Rows[i]["updateDate"].ToString();
                }
                if (!text.Equals(dataTable.Rows[i]["updateDate"].ToString()))
                {
                    dataGridView1.Rows.Add(dataGridView1.RowCount + 1, text, text2);
                    text2 = "";
                    text  = dataTable.Rows[i]["updateDate"].ToString();
                }
                string text3 = (Math.Sign(int.Parse(dataTable.Rows[i]["adjustQuantity"].ToString())) >= 0) ? ("+" + dataTable.Rows[i]["adjustQuantity"].ToString()) : dataTable.Rows[i]["adjustQuantity"].ToString();
                string text4 = (Math.Sign(int.Parse(dataTable.Rows[i]["adjustMoney"].ToString())) >= 0) ? ("+" + dataTable.Rows[i]["adjustMoney"].ToString()) : dataTable.Rows[i]["adjustMoney"].ToString();
                string text5 = "";
                string a     = dataTable.Rows[i]["adjustType"].ToString();
                if (!(a == "E"))
                {
                    if (a == "F")
                    {
                        text5 = "(過期退回)";
                    }
                }
                else
                {
                    text5 = "(原廠退貨)";
                }
                text2 = text2 + dataTable.Rows[i]["GDSNO"].ToString() + "\n" + getCommodityName(dataTable.Rows[i]) + "(" + text3 + "/" + text4 + ")" + text5 + "\n";
            }
            if (!string.IsNullOrEmpty(text2))
            {
                dataGridView1.Rows.Add(dataGridView1.RowCount + 1, text, text2);
                text2 = "";
            }
        }
        public frmSearchCommodityDeliverySummary(DataTable dt_summary, DataTable dt_details, string strFromDate, string strToDate, string data_type, string goods_type, string goods_status)
            : base("報表查詢")
        {
            _dt_summary   = dt_summary;
            _dt_details   = dt_details;
            _strFromDate  = strFromDate;
            _strToDate    = strToDate;
            _data_type    = data_type;
            _goods_type   = goods_type;
            _goods_status = goods_status;
            string text = "出貨商品:";

            InitializeComponent();
            label3.Text = strFromDate + " ~ " + strToDate;
            if (_dt_details.Rows.Count > 0)
            {
                int num    = 0;
                int num2   = 0;
                int result = 0;
                for (int i = 0; i < _dt_details.Rows.Count; i++)
                {
                    int.TryParse(_dt_details.Rows[i]["total"].ToString(), out result);
                    num += result;
                    int.TryParse(_dt_details.Rows[i]["num"].ToString(), out result);
                    num2 += result;
                    text  = text + "[" + _dt_details.Rows[i]["GDName"].ToString() + "]";
                    dataGridView2.Rows.Add(string.IsNullOrEmpty(_dt_details.Rows[i]["barcode"].ToString()) ? "" : _dt_details.Rows[i]["barcode"].ToString(), _dt_details.Rows[i]["GDName"].ToString() + "[" + _dt_details.Rows[i]["CName"].ToString() + "-" + _dt_details.Rows[i]["formCode"].ToString() + "." + _dt_details.Rows[i]["contents"].ToString() + "-" + _dt_details.Rows[i]["brandName"].ToString() + "]" + _dt_details.Rows[i]["spec"].ToString() + _dt_details.Rows[i]["capacity"].ToString(), string.IsNullOrEmpty(_dt_details.Rows[i]["num"].ToString()) ? "" : _dt_details.Rows[i]["num"].ToString(), string.IsNullOrEmpty(_dt_details.Rows[i]["total"].ToString()) ? "" : _dt_details.Rows[i]["total"].ToString());
                    List <string> list  = new List <string>();
                    int           num3  = 0;
                    string        text2 = "SELECT pgb.*,dgd.DeliveryDate FROM hypos_PurchaseGoodsBatchNo_log as pgb inner join hypos_DeliveryGoods_Master as dgd on pgb.PurchaseNo = dgd.DeliveryNo left JOIN hypos_GOODSLST as gl on pgb.barcode = gl.GDSNO where pgb.barcode = '" + _dt_details.Rows[i]["barcode"].ToString() + "' and gl.CLA1NO = '0302' ";
                    text2 = text2 + " and dgd.DeliveryDate between {" + num3 + "}  ";
                    list.Add(strFromDate);
                    num3++;
                    text2 = text2 + "  and datetime(date( {" + num3 + "} ), '+1 days') ";
                    list.Add(strToDate);
                    num3++;
                    DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, text2, list.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable);
                    if (dataTable.Rows.Count > 0)
                    {
                        for (int j = 0; j < dataTable.Rows.Count; j++)
                        {
                            dataGridView2.Rows.Add("", dataTable.Rows[j]["BatchNo"].ToString() + "/" + dataTable.Rows[j]["DeliveryDate"].ToString(), dataTable.Rows[j]["num"].ToString());
                        }
                    }
                }
                dataGridView1.Rows.Add(num, num2, _dt_details.Rows.Count);
            }
            label2.Text = text;
        }
示例#19
0
        private int CheckRepeat_fuzzy()
        {
            int       num       = 0;
            DataTable dataTable = new DataTable();
            string    text      = "SELECT * FROM Record WHERE LogicDel=0 AND VaccineCode = '" + cb_VaccineCode.SelectedValue.ToString() + "' AND ";

            dataTable = (DataTable)DataBaseUtilities.DBOperation(sql: (!(tb_RocID.Text.Trim() != "")) ? (text + "ParentRocID = '" + tb_ParentRocID.Text + "' AND BirthSeq='" + cb_BirthSeq.Text + "' AND Birthday = '" + Utility.ToRocDateString(Convert.ToDateTime(tb_Birthday2.Text)) + "' and (ExportedDate is null or ExportedDate='" + Utility.ToRocDateString(DateTime.Now) + "')") : (text + "RocID = '" + tb_RocID.Text + "' AND Birthday = '" + Utility.ToRocDateString(Convert.ToDateTime(tb_Birthday.Text)) + "' and (ExportedDate is null or ExportedDate='" + Utility.ToRocDateString(DateTime.Now) + "')"), ConnectionString: Program.ConnectionString, strParameterArray: null, cmdType: CommandOperationType.ExecuteReaderReturnDataTable);
            if (tb_RocID.Text.Trim() != "")
            {
                DataRow[] array = dt.Select("VaccineCode='" + cb_VaccineCode.SelectedValue.ToString() + "' and RocID = '" + tb_RocID.Text + "'");
                return(dataTable.Rows.Count + array.Length);
            }
            DataRow[] array2 = dt.Select("VaccineCode='" + cb_VaccineCode.SelectedValue.ToString() + "' and ParentRocID = '" + tb_ParentRocID.Text + "'");
            return(dataTable.Rows.Count + array2.Length);
        }
        protected string GetStoreID(string id)
        {
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "shipDateTime, storedId, strBARCODE, batchNO, MFD, shipQTY, shipOrReturn , b.SupplierName , b.SupplierIdNo ", " HyShipData_sub a join hypos_Supplier b on a.storedId = b.vendorId ", " 1=1  and a.LogicDel = 'N' and b.vendorName = {0} ", "", null, new string[1]
            {
                id
            }, CommandOperationType.ExecuteReaderReturnDataTable);
            string text = "";

            if (dataTable.Rows.Count > 0)
            {
                text = dataTable.Rows[0]["storedId"].ToString();
            }
            id = text;
            return(id);
        }
示例#21
0
        private void Form_Main_Load(object sender, EventArgs e)
        {
            string    sql       = "select VaccineCode,VaccineNo,VaccBatchNo,VaccineCode || ' ('||ChName|| ')' ChName from VaccineData";
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count == 0)
            {
                MessageBox.Show("尚未匯入疫苗批次資料,請先進行檔案匯入!", "系統提醒", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
                Form_ImportBatchNo form_ImportBatchNo = new Form_ImportBatchNo();
                form_ImportBatchNo.FormClosed += ChildFormClosed;
                form_ImportBatchNo.AgencyCode  = AgencyCode;
                form_ImportBatchNo.Show(this);
                Hide();
            }
        }
示例#22
0
    private void btn_UpdatePrice_Click(object sender, EventArgs e)
    {
        int    result = 0;
        string text   = tb_newPrice.Text.Trim();

        if (int.TryParse(tb_newPrice.Text.Trim(), out result))
        {
            DataBaseUtilities.DBOperation(Program.ConnectionString, "UPDATE hypos_DeliveryPrice_log set status = 'N' where GDSNO = {0}", new string[1]
            {
                _GDSNO
            }, CommandOperationType.ExecuteNonQuery);
            DataBaseUtilities.DBOperation(Program.ConnectionString, "UPDATE hypos_GOODSLST set DeliveryPrice = {1} where GDSNO = {0}", new string[2]
            {
                _GDSNO,
                text
            }, CommandOperationType.ExecuteNonQuery);
            string[,] strFieldArray = new string[5, 2]
            {
                {
                    "GDSNO",
                    _GDSNO
                },
                {
                    "Account",
                    Program.Casher
                },
                {
                    "price",
                    text
                },
                {
                    "status",
                    "Y"
                },
                {
                    "editDate",
                    DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")
                }
            };
            DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Insert, "", "hypos_DeliveryPrice_log", null, null, strFieldArray, null, CommandOperationType.ExecuteNonQuery);
            if (base.Owner != null)
            {
                (base.Owner as frmEditCommodity).textBox1.Text  = text;
                (base.Owner as frmEditCommodity)._DeliveryPrice = text;
            }
            dialogDeliveryPriceLog_Load(sender, e);
        }
    }
        protected string GetshipDateTime2(string stroreid, string barcode, string batchNO)
        {
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "shipDateTime, storedId, strBARCODE, batchNO, MFD, shipQTY, shipOrReturn , b.SupplierName , b.SupplierIdNo ", " HyShipData_sub a join hypos_Supplier b on a.storedId = b.vendorId ", " 1=1  and a.LogicDel = 'N' and a.storeName = {0} and strBARCODE = {1} and batchNO = {2} and shipOrReturn = 'K' ", "", null, new string[3]
            {
                stroreid,
                barcode,
                batchNO
            }, CommandOperationType.ExecuteReaderReturnDataTable);
            string result = "";

            if (dataTable.Rows.Count > 0)
            {
                result = dataTable.Rows[0]["shipDateTime"].ToString();
            }
            return(result);
        }
示例#24
0
    private void btn_quickSearch_Click(object sender, EventArgs e)
    {
        dataGridView1.Rows.Clear();
        DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "SupplierNo,SupplierName,SupplierIdNo,Status", "hypos_Supplier", " Status = 0 and (SupplierIdNo like {0} or SupplierName like {0})", " CreateDate Desc", null, new string[1]
        {
            "%" + tb_keyword.Text + "%"
        }, CommandOperationType.ExecuteReaderReturnDataTable);

        if (dataTable.Rows.Count > 0)
        {
            for (int i = 0; i < dataTable.Rows.Count; i++)
            {
                dataGridView1.Rows.Insert(i, false, dataTable.Rows[i]["SupplierIdNo"].ToString(), dataTable.Rows[i]["SupplierName"].ToString(), "選擇", dataTable.Rows[i]["SupplierNo"].ToString());
            }
        }
    }
示例#25
0
        public string retailData()
        {
            Program.Logger.Info("[驗證店家購肥帳密] -- 開始");
            string result = "";

            if (NetworkInterface.GetIsNetworkAvailable())
            {
                DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "FertilizerAccount,FertilizerPassword,DealerNo", "hypos_ShopInfoManage", "", "ShopIdNo limit 1", null, null, CommandOperationType.ExecuteReaderReturnDataTable);
                if (dataTable.Rows.Count > 0)
                {
                    try
                    {
                        Program.Logger.Info("[驗證店家購肥帳密] -- 資料上傳至WS 開始");
                        POSService pOSService = new POSService();
                        pOSService.Url = Program.VerificationURL;
                        Program.Logger.Info("[驗證店家購肥帳密] -- 上傳資料\nL:" + Program.LincenseCode + "\nFA:" + dataTable.Rows[0]["FertilizerAccount"].ToString() + "\nFP:" + dataTable.Rows[0]["FertilizerPassword"].ToString() + "\nD:" + dataTable.Rows[0]["DealerNo"].ToString() + "\n");
                        string xml = pOSService.sendRetailData(Program.LincenseCode, dataTable.Rows[0]["FertilizerAccount"].ToString(), dataTable.Rows[0]["FertilizerPassword"].ToString(), dataTable.Rows[0]["DealerNo"].ToString());
                        Program.Logger.Info("[驗證店家購肥帳密] -- 資料上傳至WS 結束");
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.LoadXml(xml);
                        XmlNodeList xmlNodeList = xmlDocument.SelectNodes("//RetailData");
                        if (xmlNodeList.Count <= 0)
                        {
                            return("無WebService驗證回傳資料");
                        }
                        for (int i = 0; i < xmlNodeList.Count; i++)
                        {
                            string innerText = xmlNodeList[i].SelectSingleNode("status").InnerText;
                            result = ((!"Y".Equals(innerText)) ? "購肥帳號密碼驗證錯誤" : "驗證成功");
                            Program.Logger.Info("[驗證店家購肥帳密] -- 由WS收到訊息為\nS:" + (string.IsNullOrEmpty(innerText) ? "Null" : innerText));
                        }
                        return(result);
                    }
                    catch (Exception ex)
                    {
                        Program.Logger.Fatal("[驗證店家購肥帳密] -- 發生例外狀況:" + ex.ToString());
                        return("發生錯誤 : " + ex.Message);
                    }
                }
            }
            else
            {
                Program.Logger.Info("[驗證店家購肥帳密] -- 離線中,請檢查網路");
                result = "偵測不到網路連線,請確認網路正常後再選入商品";
            }
            return(result);
        }
        private void dialogChooseSupplier_Load(object sender, EventArgs e)
        {
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "SupplierNo,SupplierName,SupplierIdNo,Status", "hypos_Supplier", " Status = 0", " CreateDate Desc", null, null, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count > 0)
            {
                for (int i = 0; i < dataTable.Rows.Count; i++)
                {
                    dataGridView1.Rows.Add(false, dataTable.Rows[i]["SupplierIdNo"].ToString(), dataTable.Rows[i]["SupplierName"].ToString(), dataTable.Rows[i]["SupplierNo"].ToString());
                }
            }
            if (dataGridView1.CurrentCell != null)
            {
                dataGridView1.ClearSelection();
                dataGridView1.CurrentRow.Selected = false;
            }
        }
示例#27
0
        public frshyscorp(frmMainShopSimpleWithMoney frsm, string barcodeNum, string name)
        {
            this.frsm       = frsm;
            this.barcodeNum = barcodeNum;
            InitializeComponent();
            string[] strWhereParameterArray = new string[1]
            {
                barcodeNum
            };
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, TableOperation.Select, "*", "hypos_GOODSLST", "GDSNO = {0}", "", null, strWhereParameterArray, CommandOperationType.ExecuteReaderReturnDataTable);

            hyscope.Text = "【" + getCommodityName(dataTable.Rows[0]) + "】" + hyscope.Text.ToString();
            _pesticideId = dataTable.Rows[0]["pesticideId"].ToString();
            _formCode    = dataTable.Rows[0]["formCode"].ToString();
            _contents    = dataTable.Rows[0]["contents"].ToString();
            loaddata();
        }
示例#28
0
        private void btn_enter_Click(object sender, EventArgs e)
        {
            if (tb_vipNo.Text == "請輸入會員編號" && tb_vipName.Text == "請輸入會員姓名" && tb_vipTelNo.Text == "請輸入會員電話" && tb_IdNo.Text == "請輸入身分證字號")
            {
                AutoClosingMessageBox.Show("必須輸入查詢條件");
                return;
            }
            btn_pageLeft.Visible  = true;
            btn_pageRight.Visible = true;
            l_pageInfo.Visible    = true;
            label1.Text           = "會員搜尋結果";
            int           num  = 0;
            List <string> list = new List <string>();
            string        text = "SELECT * FROM hypos_CUST_RTL WHERE status = 0 ";

            if (tb_vipNo.Text != "請輸入會員編號")
            {
                text = text + " AND VipNo like {" + num + "}";
                list.Add("%" + tb_vipNo.Text + "%");
                num++;
            }
            if (tb_vipName.Text != "請輸入會員姓名")
            {
                text = text + " AND Name like {" + num + "}";
                list.Add("%" + tb_vipName.Text + "%");
                num++;
            }
            if (tb_IdNo.Text != "請輸入身分證字號")
            {
                text = text + " AND IdNo like {" + num + "}";
                list.Add("%" + tb_vipTelNo.Text + "%");
                num++;
            }
            if (tb_vipTelNo.Text != "請輸入會員電話")
            {
                text = text + " AND (Telphone like {" + num + "}";
                list.Add("%" + tb_vipTelNo.Text + "%");
                num++;
                text = text + " OR Mobile like {" + num + "})";
                list.Add("%" + tb_vipTelNo.Text + "%");
                num++;
            }
            dt = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, text, list.ToArray(), CommandOperationType.ExecuteReaderReturnDataTable);
            changePage(1);
        }
示例#29
0
 private void btn_Export_Click(object sender, EventArgs e)
 {
     try
     {
         DataTable dataTable  = new DataTable();
         DataTable dataTable2 = new DataTable();
         string    str        = "";
         string    str2       = "";
         if (aa == 1)
         {
             str  = str + "select RocID,CaseName, Sex,Birthday,BirthSeq,Address,Tel,ParentRocID,AgencyCode,InoculationDate,VaccineCode,VaccineNo,VaccBatchNo,'' as '疫苗廠商',(select  BatchType from VaccineData where VaccBatchNo=Record.VaccBatchNo order by BatchType desc LIMIT 1 ) 疫苗型別,'' AS '曾接種流感疫苗' from Record where isFlu=0 and (ExportedDate is null or ExportedDate='" + Utility.ToRocDateString(DateTime.Now) + "');";
             str2 = str2 + "select RocID,CaseName,Birthday,Address,Tel,ParentRocID,AgencyCode,InoculationDate,VaccBatchNo, (select  ChName from VaccineData where VaccBatchNo=Record.VaccBatchNo order by ChName desc limit  1),VaccineNo from Record where isFlu=1 and (ExportedDate is null or ExportedDate='" + Utility.ToRocDateString(DateTime.Now) + "');";
         }
         else
         {
             str  += "select RocID,CaseName, Sex,Birthday,BirthSeq,Address,Tel,ParentRocID,AgencyCode,InoculationDate,VaccineCode,VaccineNo,VaccBatchNo,'' as '疫苗廠商',(select  BatchType from VaccineData where VaccBatchNo=Record.VaccBatchNo order by BatchType desc LIMIT 1 ) as '疫苗型別','' as '曾接種流感疫苗' from Record where isFlu=0 and ExportedDate is null;";
             str2 += "select RocID,CaseName,Birthday,Address,Tel,ParentRocID,AgencyCode,InoculationDate,VaccBatchNo, (select  ChName from VaccineData where VaccBatchNo=Record.VaccBatchNo order by ChName desc limit  1),VaccineNo from Record where isFlu=1 and ExportedDate is null;";
         }
         string str3 = "update Record set ExportedDate='" + Utility.ToRocDateString(DateTime.Now) + "' where ExportedDate is null";
         dataTable  = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, str, null, CommandOperationType.ExecuteReaderReturnDataTable);
         dataTable2 = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, str2 + str3, null, CommandOperationType.ExecuteReaderReturnDataTable);
         FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();
         folderBrowserDialog.ShowDialog();
         if (folderBrowserDialog.SelectedPath == "")
         {
             MessageBox.Show("請選擇匯出檔案要儲存的資料夾");
         }
         else
         {
             string str4 = folderBrowserDialog.SelectedPath + "\\";
             string text = "預注資料" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv";
             GenFile(dataTable, str4 + text);
             string text2 = "流感資料" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".csv";
             GenFile_Flu(dataTable2, str4 + text2);
             MessageBox.Show(text + "、" + text2 + " 匯出成功!", "匯出成功", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
             Close();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("匯出失敗,原因:" + ex.Message, "發生錯誤", MessageBoxButtons.OK, MessageBoxIcon.Hand);
         string str5 = "C:\\NIISOL\\";
         Utility.WriteToFile(str5 + "\\" + DateTime.Now.ToString("yyyy-MM-dd") + "_log.txt", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + "\tForm_Export.cs: " + ex.Message, 'A', "");
     }
 }
示例#30
0
        private void btn_view_Click(object sender, EventArgs e)
        {
            DateTime  dateTime  = DateTime.Now.AddMonths(-2);
            DateTime  now       = DateTime.Now;
            string    text      = new DateTime(dateTime.Year, dateTime.Month, 1, 0, 0, 0).ToString("yyyy-MM-dd HH:mm:ss");
            string    text2     = new DateTime(now.Year, now.Month, DateTime.DaysInMonth(now.Year, now.Month), 23, 59, 59).ToString("yyyy-MM-dd HH:mm:ss");
            string    sql       = "SELECT hms.sellNo,hms.sellTime,hms.memberId,hms.items,hcr.Name,hcr.Mobile ,hcr.IdNo,hcr.CompanyIdNo,hms.cash,hms.Credit,hms.sum FROM hypos_main_sell as hms left outer join hypos_CUST_RTL as hcr on hms.memberId= hcr.VipNo WHERE sellTime >='" + text + "' and sellTime <='" + text2 + "'";
            DataTable dataTable = (DataTable)DataBaseUtilities.DBOperation(Program.ConnectionString, sql, null, CommandOperationType.ExecuteReaderReturnDataTable);

            if (dataTable.Rows.Count > 0)
            {
                switchForm(new frmSearchSellResult_View(dataTable));
            }
            else
            {
                AutoClosingMessageBox.Show("無近期銷售單");
            }
        }