示例#1
0
        private void ButtonEdit_Click(object sender, System.EventArgs e)
        {
            if (DataGridViewX1.SelectedRows.Count == 1)
            {
                int           selectedRowId = int.Parse(DataGridViewX1.SelectedRows[0].Cells["角色编号"].Value.ToString());
                FrmRoleDetail frm           = new FrmRoleDetail
                {
                    Roleid        = selectedRowId,
                    StartPosition = FormStartPosition.CenterParent
                };

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    RefreshGridView();
                }
            }
            else if (DataGridViewX1.SelectedRows.Count > 1)
            {
                CustomDesktopAlert.H2("只能选择一行编辑");
            }
            else
            {
                CustomDesktopAlert.H2("请先选择要编辑的行");
            }
        }
示例#2
0
 private void ButtonDelete_Click(object sender, System.EventArgs e)
 {
     if (MessageBoxEx.Show("你真的要删除这些记录码?", "系统信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         if (DataGridViewX1.Rows.Count > 0)
         {
             string selectedRows = "";
             foreach (DataGridViewRow dr in DataGridViewX1.Rows)
             {
                 //checkbox 未选择时,单元个的值为空
                 if (dr.Selected == true)
                 {
                     selectedRows += dr.Cells["角色编号"].Value + ",";
                 }
             }
             if (selectedRows.Length > 0)
             {
                 selectedRows = selectedRows.Substring(0, selectedRows.Length - 1);
                 if (bllSysRole.DeleteList(selectedRows) == true)
                 {
                     CustomDesktopAlert.H2("记录编号" + selectedRows + "删除成功!");
                     //pager2.PageIndex = 1;
                     //删除事件,要重新计算RecCount
                     RefreshGridView();
                 }
             }
         }
     }
     //清空全选
     HeaderCheckBox.Checked = false;
 }
示例#3
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AutoUpdater au = new AutoUpdater();

            try
            {
                au.Update();
            }
            catch (WebException exp)
            {
                CustomDesktopAlert.H2(String.Format("无法找到指定资源\n\n{0}", exp.Message));
            }
            catch (XmlException exp)
            {
                CustomDesktopAlert.H2(String.Format("下载的升级文件有错误\n\n{0}", exp.Message));
            }
            catch (NotSupportedException exp)
            {
                CustomDesktopAlert.H2(String.Format("升级地址配置错误\n\n{0}", exp.Message));
            }
            catch (ArgumentException exp)
            {
                CustomDesktopAlert.H2(String.Format("下载的升级文件有错误\n\n{0}", exp.Message));
            }
            catch (Exception exp)
            {
                CustomDesktopAlert.H2(String.Format("升级过程中发生错误\n\n{0}", exp.Message));
            }

            Application.Run(new FrmMain());
        }
示例#4
0
        private void TextBoxX2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string QRCode     = textBoxX2.Text;
                string mingQRCode = EncryptHelper.Decrypt(QRCode);
                if (!string.IsNullOrEmpty(mingQRCode) && IsNumeric(mingQRCode))
                {
                    string tableName = "t_QRCode" + mingQRCode.Substring(0, 4);
                    string sql       = string.Format("SELECT TOP 1 [FSTATE] FROM " + tableName + "  WHERE [FQRCode] = '" + mingQRCode + "' ORDER BY [FCREATEDATE] DESC ");
                    object obj       = SqlHelper.ExecuteScalar(conn, sql);
                    if (obj != null && obj.ToString().ToLower() == "c")
                    {
                        CustomDesktopAlert.H2("唯一码已核销!");
                    }
                    else
                    {
                        CustomDesktopAlert.H2("唯一码未核销或者不存在!");
                    }
                }
                else
                {
                    CustomDesktopAlert.H2("不能识别的唯一码!");
                }

                //清空二维码框
                textBoxX2.Text = "";
            }
        }
示例#5
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonX1_Click(object sender, EventArgs e)
        {
            dataGridViewX1.DataSource = null;
            string billType = comboBoxEx2.SelectedIndex == 0 ? "XOUT" : "QOUT";
            string billNo   = billType + textBoxX1.Text;
            string interID  = billNo + comboBoxEx1.SelectedValue.ToString().PadLeft(4, '0');

            SqlParameter[] parms = { new SqlParameter("@interID", interID) };
            dt = SqlHelper.ExecuteDataSet(conn, CommandType.StoredProcedure, "getQRCodeByinterID", parms).Tables[0];
            if (dt.Rows.Count > 0)
            {
                dt.Columns.Add("QRCode", typeof(System.String));//二维码

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    dt.Rows[i]["QRCode"] = EncryptHelper.Encrypt(dt.Rows[i]["FQRCode"].ToString());
                }
                dataGridViewX1.DataSource            = dt;
                dataGridViewX1.Columns[0].HeaderText = "编号";
                dataGridViewX1.Columns[1].HeaderText = "二维码";
                dataGridViewX1.Columns[1].Width      = 300;
            }
            else
            {
                CustomDesktopAlert.H2("无记录!请检查单据设置");
            }
        }
示例#6
0
        private void DeleteMail()
        {
            using (POP3_Client c = new POP3_Client())
            {
                c.Connect(serverName, pop3Port, false);
                c.Login(loginName, password);

                if (c.Messages.Count > 0)
                {
                    foreach (POP3_ClientMessage mail in c.Messages)
                    {
                        try
                        {
                            if (lviMail.SubItems[4].Text == mail.UID)
                            {
                                CustomDesktopAlert.H2(mail.UID);
                                mail.MarkForDeletion();
                                lviMail.Remove();
                            }
                        }
                        catch (Exception ex)
                        {
                            MessageBox.Show(ex.Message);
                            //LogTextHelper.Error(ex);
                        }
                    }
                }
            }
        }
示例#7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="EntryID"></param>
        /// <returns></returns>
        private int DeleteDetailTable(string EntryID)
        {
            int retVal = 0;

            string[] prodT        = null;
            string   prodType0    = "17";
            string   prodType1    = "16;18";
            string   confProdType = ConfigHelper.ReadValueByKey(ConfigHelper.ConfigurationFile.AppConfig, "Modules");

            if (confProdType == EnumProductType.ds9208_护理液.ToString())
            {
                prodT = prodType0.Split(';');
            }
            else if (confProdType == EnumProductType.ds9208_镜片.ToString())
            {
                prodT = prodType1.Split(';');
            }
            else
            {
                CustomDesktopAlert.H2("产品类型设置错误!");
            }

            string baseTableName = "dbo.t_QRCode";

            for (int j = 0; j < prodT.Length; j++)
            {
                for (int i = 0; i < 100; i++)
                {
                    string fID = i < 10 ? "0" + i.ToString() : i.ToString();
                    sql     = string.Format("DELETE {0}{1}{2} WHERE FEntryID = '{3}'", baseTableName, prodT[j], fID, EntryID);
                    retVal += SqlHelper.ExecuteNonQuery(conn, sql);
                }
            }
            return(retVal);
        }
示例#8
0
        /// <summary>
        ///回车删除一个唯一码
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TextBoxX2_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                string billType     = comboBoxEx2.SelectedIndex == 0 ? "XOUT" : "QOUT";
                string billNo       = billType + textBoxX1.Text;
                string QRCode       = textBoxX2.Text;
                string mingQRCode   = EncryptHelper.Decrypt(QRCode);
                string EntryID      = comboBoxEx1.SelectedValue.ToString();
                string interID      = billNo + comboBoxEx1.SelectedValue.ToString().PadLeft(4, '0');
                string tableName    = "t_QRCode" + mingQRCode.Substring(0, 4);
                int    retValDetail = 0;
                int    retValTotal  = 0;
                sql          = string.Format("DELETE FROM " + tableName + "  WHERE [FQRCode] = '" + mingQRCode + "' AND [FEntryID] = '" + interID + "'");
                retValDetail = SqlHelper.ExecuteNonQuery(conn, sql);
                sql          = string.Format("UPDATE [icstock] SET [FActQty] = [FActQty] - 1 WHERE  [单据编号] = '{0}' AND [FActQty] > 0 AND [FEntryID] = {1}", billNo, EntryID.ToString());
                retValTotal  = SqlHelper.ExecuteNonQuery(conn, sql);
                if (retValTotal > 0 && retValDetail > 0)
                {
                    CustomDesktopAlert.H2("二维码删除成功!");
                }
                else if (retValDetail < 1)
                {
                    CustomDesktopAlert.H2("二维码不存在!");
                }
                else
                {
                    CustomDesktopAlert.H2("二维码删除失败!");
                }

                //清空二维码框
                textBoxX2.Text = "";
            }
        }
示例#9
0
        private void ButtonX1_Click(object sender, EventArgs e)
        {
            string startDate = dateTimeInput1.Value.ToString("yyyy-MM-dd").Substring(0, 10);
            string endDate   = dateTimeInput2.Value.ToString("yyyy-MM-dd").Substring(0, 10);

            if (startDate != "0001-01-01" && endDate != "0001-01-01")
            {
                sql = string.Format("SELECT [日期],[购货单位],[单据编号],sum([实发数量]) as 应扫数量, sum([FActQty]) as 实扫数量  FROM [dbo].[icstock]  where [日期] >= '{0} 00:00:00' and [日期] <= '{1} 23:59:59' and [实发数量] > 0 and [产品编号] Like '02%' group by [日期],[购货单位],[单据编号] order by [日期],[购货单位],[单据编号]", startDate, endDate);
                dt  = SqlHelper.ExecuteDataTable(conn, sql);
                dataGridViewX1.DataSource            = dt;
                dataGridViewX1.Columns["购货单位"].Width = 300;
                dataGridViewX1.Columns["日期"].Width   = 200;

                foreach (DataGridViewRow Datagridviewrow in dataGridViewX1.Rows)
                {
                    Datagridviewrow.Selected = false;

                    if (int.Parse(Datagridviewrow.Cells["应扫数量"].Value.ToString()) != int.Parse(Datagridviewrow.Cells["实扫数量"].Value.ToString()))
                    {
                        Datagridviewrow.Selected = true;
                    }
                }
            }
            else
            {
                CustomDesktopAlert.H2("请输入有效的开始时间和结束时间!");
            }
        }
示例#10
0
        /// <summary>
        /// 导入数据主程序
        /// </summary>
        /// <param name="dt">Excel 数据表</param>
        /// <param name="billNoFieldName">单号列的名字</param>
        /// <returns></returns>
        private bool ImportData_XC(DataTable dt, string billNoFieldName)
        {
            bool retVal = true;

            if (dt.Rows.Count > 0)
            {
                //得到单据号的列表
                string   distinctBillNo = GetDistinctBillNo(dt, billNoFieldName);
                string[] billNos        = distinctBillNo.Split(';');

                foreach (string billNo in billNos)
                {
                    //得到一张单数据
                    DataTable tmpdt = FilterData(dt, billNoFieldName + " = '" + billNo + "'");

                    //处理销售数据
                    InsertSaleBill_XC(tmpdt);

                    //处理赠送数据
                    InsertFreeBill_XC(tmpdt);

                    //处理5P数据
                    Insert5PBill_XC(tmpdt);
                }
            }
            else
            {
                CustomDesktopAlert.H2("没有可用的数据!");
                return(false);
            }
            return(retVal);
        }
示例#11
0
        /// <summary>
        /// 打开
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonX2_Click(object sender, EventArgs e)
        {
            OpenFileDialog dialog = new OpenFileDialog
            {
                InitialDirectory = "C:\\Users\\Ray\\Desktop",//注意这里写路径时要用c:\\而不是c:\
                Filter           = "Excel2007文件|*.xlsx|Excel2003文件|*.xls|所有文件|*.*",
                RestoreDirectory = true,
                FilterIndex      = 1
            };

            if (dialog.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            else
            {
                this.dataGridViewX1.DataSource = null;
                string fileName = dialog.FileName;
                template = SwichTemplateType(fileName);
                Convert2DataTable c2d = new Convert2DataTable();
                //string sheetName = template == TemplateType.日立 ? "门店信息" : "订单明细";
                string sheetName = template == TemplateType.日立 ? "门店信息" : "Sheet1";
                dt = c2d.Excel2DataTable(fileName, sheetName, null, null);
                this.dataGridViewX1.DataSource = dt;
                CustomDesktopAlert.H2("成功打开Excel文件!");
            }
        }
示例#12
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonX1_Click(object sender, EventArgs e)
        {
            mingQRCode = EncryptHelper.Decrypt(textBoxX2.Text);
            //mingQRCode = textBoxX2.Text;
            //if (!string.IsNullOrEmpty(mingQRCode) && mingQRCode.Length == 9 && mingQRCode.StartsWith(DateTime.Now.Year.ToString().Substring(2)))
            if (!string.IsNullOrEmpty(mingQRCode) && mingQRCode.Length == 9)
            {
                string tableName = "t_QRCode" + mingQRCode.Substring(0, 4);
                ///二维码是否存在
                sql = string.Format("SELECT FEntryID AS interID FROM [dbo].[{0}] WHERE [FQRCode] = '{1}' ", tableName, mingQRCode);
                object obj = SqlHelper.ExecuteScalar(conn, sql);
                if (obj != null)
                {
                    sql = string.Format("SELECT FEntryID as interID FROM [dbo].[{0}] WHERE [FQRCode] = '{1}' ORDER BY FCodeID DESC", tableName, mingQRCode);
                    object obj1    = SqlHelper.ExecuteScalar(conn, sql);
                    string interID = obj1 != null?obj1.ToString() : "";

                    string billNo  = interID.Substring(0, 10);
                    int    entryID = int.Parse(interID.Substring(10));
                    sql = string.Format("SELECT * FROM [icstock] WHERE [单据编号] = '{0}' AND [FEntryID] = {1}", billNo, entryID.ToString());
                    dt  = SqlHelper.ExecuteDataTable(conn, sql);
                    dataGridViewX1.DataSource = dt;
                }
                else
                {
                    CustomDesktopAlert.H2(string.Format("{0} 二维码不存在!", mingQRCode));
                }
            }
            else
            {
                CustomDesktopAlert.H2("无效的二维码!");
            }
        }
示例#13
0
        /// <summary>
        /// 日立导入数据
        /// </summary>
        /// <param name="dt">Excel 数据表</param>
        /// <param name="billNoFieldName">单号列的名字</param>
        /// <returns></returns>
        private bool ImportData_RL(DataTable dt, string billNoFieldName)
        {
            bool retVal = false;

            if (dt.Rows.Count > 0)
            {
                //得到单据号的列表
                string   distinctBillNo = GetDistinctBillNo(dt, billNoFieldName);
                string[] billNos        = distinctBillNo.Split(';');

                foreach (string billNo in billNos)
                {
                    //得到一张单数据
                    DataTable tmpdt = FilterData(dt, "订单号 = '" + billNo + "'");

                    //ImportSaleBill
                    InsertSaleBill_RL(tmpdt);
                }
            }
            else
            {
                CustomDesktopAlert.H2("没有可用的数据!");
            }

            return(retVal);
        }
示例#14
0
 private void ButtonX1_Click(object sender, EventArgs e)
 {
     sql = string.Format("SELECT  DISTINCT TOP 200 CONVERT(varchar(10), [日期], 120) as 单据日期,[单据编号] FROM [dbo].[icstock] WHERE [FActQty] > 0 ORDER BY CONVERT(varchar(10), [日期], 120) DESC");
     dt  = SqlHelper.ExecuteDataTable(conn, sql);
     CustomDesktopAlert.H2(dt.Rows.Count.ToString());
     dataGridViewX1.DataSource = dt;
 }
示例#15
0
        private void LoadModule()
        {
            string myModules = ConfigHelper.ReadValueByKey(ConfigHelper.ConfigurationFile.AppConfig, "Modules");

            if (!string.IsNullOrWhiteSpace(myModules))
            {
                string[] myModule = myModules.Split(';');
                foreach (string module in myModule)
                {
                    if (module.ToLower() == ModuleName.edi.ToString())
                    {
                        ribbonTabItem2.Visible = true;
                        ribbonTabItem2.Select();
                    }
                    else if (module.ToLower() == ModuleName.edi2.ToString())
                    {
                        ribbonTabItem1.Visible = true;
                        ribbonTabItem1.Select();
                    }
                    else if (module.ToLower() == ModuleName.ds9208_镜片.ToString())
                    {
                        ribbonTabItem3.Visible = true;
                        ribbonTabItem3.Select();
                    }
                    else
                    {
                        CustomDesktopAlert.H2(module.ToLower() + "不能识别的应用模块!");
                    }
                }
            }
            else
            {
                CustomDesktopAlert.H2("应用程序加载模块出错!");
            }
        }
示例#16
0
        private void ButtonEdit_Click(object sender, EventArgs e)
        {
            if (DataGridViewX1.SelectedRows.Count == 1)
            {
                //CustomDesktopAlert.H2(DataGridViewX1.SelectedRows[0].Cells["部门编号"].Value.ToString());
                int           selectedRowId = int.Parse(DataGridViewX1.SelectedRows[0].Cells["条目编号"].Value.ToString());
                FrmDictDetail frm           = new FrmDictDetail
                {
                    DictDataId    = selectedRowId,
                    DictTypeId    = int.Parse(advTree1.SelectedNode.Tag.ToString()),
                    StartPosition = FormStartPosition.CenterParent
                };

                if (frm.ShowDialog() == DialogResult.OK)
                {
                    RefreshGridView();
                }
            }
            else if (DataGridViewX1.SelectedRows.Count > 1)
            {
                CustomDesktopAlert.H2("只能选择一行编辑");
            }
            else
            {
                CustomDesktopAlert.H2("请先选择要编辑的行");
            }
        }
示例#17
0
 private void ButtonDelete_Click(object sender, EventArgs e)
 {
     if (MessageBoxEx.Show("你真的要删除这些记录码?", "系统信息", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
     {
         if (DataGridViewX1.Rows.Count > 0)
         {
             string selectedRows = "";
             foreach (DataGridViewRow dr in DataGridViewX1.Rows)
             {
                 if (dr.Selected == true)
                 {
                     selectedRows += dr.Cells["条目编号"].Value + ",";
                 }
             }
             if (selectedRows.Length > 0)
             {
                 selectedRows = selectedRows.Substring(0, selectedRows.Length - 1);
                 if (bllSysDictData.DeleteList(selectedRows) == true)
                 {
                     CustomDesktopAlert.H2("记录编号" + selectedRows + "删除成功!");
                     RefreshGridView();
                 }
             }
         }
     }
 }
示例#18
0
        /// <summary>
        /// 用户输入新的出库单号并确认
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void TextBoxX1_KeyDown(object sender, KeyEventArgs e)
        {
            ////用户按下回车键
            if (e.KeyCode == Keys.Enter)
            {
                //清空选项,
                dataGridViewX1.DataSource = (DataTable)null;
                dataGridViewX1.Rows.Clear();
                dataGridViewX1.Columns.Clear();
                //单据编号为数字
                if (!string.IsNullOrEmpty(textBoxX1.Text) && CommonProcess.IsNumber(textBoxX1.Text))
                {
                    //清空二维码列表,
                    mingQRCodes = "";
                    //得到单据编号
                    string billType = comboBoxEx2.SelectedIndex == 0 ? "XOUT" : "QOUT";
                    string billNo   = billType + textBoxX1.Text;
                    //收到单据分录信息
                    //int recCount = int.Parse(SqlHelper.GetSingle("select count(*) from icstock where [单据编号] ='" + billNo + "' and [FActQty] < [实发数量]",null).ToString());
                    sql = string.Format("SELECT COUNT(*) FROM icstock WHERE [单据编号] ='{0}' AND [FActQty] < [实发数量]", billNo);
                    object obj      = SqlHelper.ExecuteScalar(connALiClouds, sql);
                    int    recCount = obj != null?int.Parse(obj.ToString()) : 0;

                    if (recCount > 0)
                    {
                        //DataTable dtmaster = SqlHelper.ExcuteDataTable("select top 1 [日期],[购货单位],[发货仓库],[摘要] from icstock where [单据编号] ='" + billNo + "' and [FActQty] < [实发数量]");
                        sql = string.Format("SELECT TOP 1 [日期],[购货单位],[发货仓库],[摘要] FROM icstock WHERE [单据编号] ='{0}' AND [FActQty] < [实发数量]", billNo);
                        DataTable dtmaster = SqlHelper.ExecuteDataTable(connALiClouds, sql);
                        textBoxX2.Text = dtmaster.Rows[0][0].ToString();
                        textBoxX3.Text = dtmaster.Rows[0][1].ToString();
                        textBoxX4.Text = dtmaster.Rows[0][2].ToString();

                        //dt = SqlHelper.ExcuteDataTable("select [fEntryID] as 分录号,[产品名称],[批号],[实发数量] as 应发,[FActQty] as 实发  from icstock where [单据编号] ='" + billNo + "' and [FActQty] < [实发数量] order by fEntryID");
                        sql = string.Format("SELECT [fEntryID] AS 分录号,[产品名称],[批号],[实发数量] AS 应发,[FActQty] AS 实发  FROM icstock WHERE [单据编号] ='{0}' AND [FActQty] < [实发数量] ORDER BY fEntryID", billNo);
                        dt  = SqlHelper.ExecuteDataTable(connALiClouds, sql);
                        dataGridViewX1.DataSource = dt;
                        DataGridViewCheckBoxColumn newColumn = new DataGridViewCheckBoxColumn
                        {
                            HeaderText = "选择"
                        };
                        dataGridViewX1.Columns.Insert(0, newColumn);
                        dataGridViewX1.Columns["产品名称"].Width = 400;
                        dataGridViewX1.Rows[0].Selected      = true;
                        //
                        textBoxItem1.Focus();
                    }
                    else
                    {
                        CustomDesktopAlert.H2("无数据,请检查单据编号的输入!");
                    }
                }
                else
                {
                    CustomDesktopAlert.H2("请检查单据编号的输入!");
                }
            }
        }
示例#19
0
        /// <summary>
        /// 导入
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonX1_Click(object sender, EventArgs e)
        {
            //string[] distinctBillNos = CommonProcess.GetDistinctBillNo(dtExcelData, "fbillNo").Split(';');

            //int SuccessCount = 0;
            //foreach (string BillNo in distinctBillNos)
            //{
            //    if (ExistBill(BillNo) == false)
            //    {
            //        DataTable dtABill = CommonProcess.FilterData(dtExcelData, "");
            //        if (dtABill.Rows.Count > 0)
            //        {
            //            SuccessCount += InsertBill(dtABill);
            //        }
            //    }
            //}
            //CustomDesktopAlert.H2(string.Format("共成功导入 {0} 条记录!", SuccessCount.ToString()));
            if (dt.Rows.Count > 0)
            {
                int recCount = 0;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    StockBill bill = new StockBill
                    {
                        ///对应关系修改
                        日期      = dt.Rows[i]["fdate"].ToString(),
                        单据编号    = dt.Rows[i]["fbillNo"].ToString(),
                        EntryID = dt.Rows[i]["fEntryID"].ToString(),
                        购货单位    = dt.Rows[i]["fSupplyID"].ToString(),
                        发货仓库    = dt.Rows[i]["FDCSPID"].ToString(),
                        产品名称    = dt.Rows[i]["fitemID"].ToString(),
                        规格型号    = "",
                        实发数量    = float.Parse(dt.Rows[i]["fQty"].ToString()),
                        批号      = dt.Rows[i]["fBatchNo"].ToString(),
                        摘要      = dt.Rows[i]["fNote"].ToString(),
                        FAuxQty = 0,
                        产品编号    = dt.Rows[i][FProductId].ToString(),
                        客户编号    = dt.Rows[i][FCustomId].ToString(),
                        门店编号    = dt.Rows[i][FStoreId].ToString()
                    };

                    //去重复
                    sql = string.Format("Select Count(*) From [icstock] WHERE [单据编号] = '" + bill.单据编号 + "' AND fEntryID = " + bill.EntryID.ToString());
                    object obj = SqlHelper.ExecuteScalar(conn, sql);
                    if (obj != null && int.Parse(obj.ToString()) < 1)
                    {
                        sql = string.Format("INSERT INTO [icstock] ([日期],[单据编号],[FEntryID],[购货单位],[发货仓库] ,[产品名称] ,[规格型号] ,[实发数量] ,[批号] ,[摘要], [FActQty], [客户编号], [门店编号], [产品编号]) VALUES ('{0}','{1}','{2}','{3}','{4}','{5}','{6}',{7},'{8}','{9}',{10},'{11}', '{12}', '{13}')", bill.日期, bill.单据编号, bill.EntryID, bill.购货单位, bill.发货仓库, bill.产品名称, bill.规格型号, bill.实发数量, bill.批号, bill.摘要, bill.FAuxQty, bill.客户编号, bill.门店编号, bill.产品编号);
                        if (SqlHelper.ExecuteNonQuery(conn, sql) > 0)
                        {
                            recCount++;
                        }
                    }
                }
                CustomDesktopAlert.H2(string.Format("共成功导入 {0} 条记录!", recCount.ToString()));
            }
        }
示例#20
0
        /// <summary>
        ///
        /// </summary>
        private void UpdateQRCode2AliCloud()
        {
            //取得所有的缓存数据
            DataTable dtAllData = new DataTable();

            dtAllData = AccessHelper.ExecuteDataTable(connAccess, "SELECT [FCodeID],[FQRCode], [FBillNoEntryId] FROM T_QRCODE");

            //得到唯一的单据行号
            string[] DistinctBillNo = GetDistinctBillNo(dtAllData, "FBillNoEntryId").Split(';');

            //对每一行进行处理
            foreach (string billNo in DistinctBillNo)
            {
                //过滤只留下一行数据
                DataTable dtFilteredData = FilterData(dtAllData, "FBillNoEntryId = '" + billNo + "'");

                //生成插入语句
                sql = BuildDetailSql(dtFilteredData);

                //写入云
                int ret = SqlHelper.ExecuteNonQuery(connALiClouds, sql);

                //如果返回值等于一行数据的个数,表示该行数据已经到云
                if (ret == dtFilteredData.Rows.Count)
                {
                    // 更新主表中已扫个数
                    string billNoEntryID = dtFilteredData.Rows[0]["FBillNoEntryId"].ToString();
                    int    retUpdateQty  = UpdateCloudQty(billNoEntryID, ret);
                    //更新成功
                    if (retUpdateQty > 0)
                    {
                        //删除ACCESS数据库中的该行数据
                        sql = string.Format("Delete from t_QRCode where FBillNoEntryId = '{0}'", billNoEntryID);
                        int retInt = AccessHelper.ExecuteNonQuery(connAccess, sql);
                        if (retInt == ret)
                        {
                            //删除成功,则是上传成功
                            CustomDesktopAlert.H2("数据上传成功!");
                        }
                        else
                        {
                            //删除失败,则是上传失败
                            CustomDesktopAlert.H2("数据上传失败!");
                        }
                    }
                    else
                    {
                        //更新个数失败
                        CustomDesktopAlert.H2("更新主表失败!");
                    }
                }
                else
                {
                    CustomDesktopAlert.H2("保存数据出错!");
                }
            }
        }
示例#21
0
        /// <summary>
        /// 过程用时测试
        /// </summary>
        private void ElapsedTest()
        {
            /// Only for Test
            Stopwatch st = new Stopwatch();

            st.Start();
            string s = EncryptHelper.Decrypt("7zJ4H8PZhiZBVZE5AX03Xg==");

            st.Stop();
            CustomDesktopAlert.H2("耗时为:" + st.ElapsedMilliseconds + "毫秒");
            ///
        }
示例#22
0
 private void ButtonClean_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(baseCondition))
     {
         TextBoxX_QueryString.Text = "";
         queryCondition            = baseCondition + TextBoxX_QueryString.Text;
         pager2.PageIndex          = 1;
         RefreshGridView();
     }
     else
     {
         CustomDesktopAlert.H2("请先选择字典类型!");
     }
 }
示例#23
0
 /// <summary>
 /// 执行存储过程,插入计数
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void ButtonX2_Click(object sender, EventArgs e)
 {
     try
     {
         //注意使用库的版本,连接字符串是否加密
         //string conn = EncryptHelper.Decrypt(SqlHelper.GetConnectionString(Connection_Name));
         SqlHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, Procedure_Name, null);
     }
     catch (Exception e1)
     {
         MessageBox.Show(e1.Message);
     }
     finally
     {
         CustomDesktopAlert.H2("统计计数完成!");
     }
 }
示例#24
0
        /// <summary>
        /// 生成,仅开放16-18库的QRCode
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonX2_Click(object sender, EventArgs e)
        {
            string year       = textBoxX1.Text;
            string tableIndex = textBoxX2.Text;

            ///2018-06-02 新增 对年份和表序号的检验,且库序号不能为99,99库测试专用
            if (int.Parse(year) >= 16 && int.Parse(year) <= 18 && int.Parse(tableIndex) >= 0 && int.Parse(tableIndex) < 99)
            {
                dt = QRCodeBuilder(year, tableIndex, true);
                this.dataGridViewX1.DataSource      = dt;
                dataGridViewX1.Columns["二维码"].Width = 240;
            }
            else
            {
                CustomDesktopAlert.H2("请输入有效的年份和表序号");
            }
        }
示例#25
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AutoUpdater au = new AutoUpdater();

            try
            {
                au.Update();
            }
            catch (WebException exp)
            {
                CustomDesktopAlert.H2(String.Format("无法找到指定资源\n\n{0}", exp.Message));
            }
            catch (XmlException exp)
            {
                CustomDesktopAlert.H2(String.Format("下载的升级文件有错误\n\n{0}", exp.Message));
            }
            catch (NotSupportedException exp)
            {
                CustomDesktopAlert.H2(String.Format("升级地址配置错误\n\n{0}", exp.Message));
            }
            catch (ArgumentException exp)
            {
                CustomDesktopAlert.H2(String.Format("下载的升级文件有错误\n\n{0}", exp.Message));
            }
            catch (Exception exp)
            {
                CustomDesktopAlert.H2(String.Format("升级过程中发生错误\n\n{0}", exp.Message));
            }

            string modelName = ConfigHelper.ReadValueByKey(ConfigHelper.ConfigurationFile.AppConfig, "ModelName");

            if (modelName.ToLower() == "checkmailstat")
            {
                Application.Run(new FrmCheckQRCodeState());
            }
            else
            {
                Application.Run(new FrmMain());
            }
        }
示例#26
0
        /// <summary>
        /// 查询QRCode的计数
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonX1_Click(object sender, EventArgs e)
        {
            //统计计数
            //SqlHelper.ExecuteNonQuery(SqlHelper.GetConnectionString(Connection_Name), CommandType.StoredProcedure, Procedure_Name, null);


            string startDate = dateTimeInput1.Value.ToString("yyyy-MM-dd").Substring(0, 10);
            string endDate   = dateTimeInput2.Value.ToString("yyyy-MM-dd").Substring(0, 10);

            if (startDate != "0001-01-01" && endDate != "0001-01-01")
            {
                int startCounter = 0;
                int endCounter   = 0;

                //用“小于”是指最接近的前一天的下班计数
                sql = string.Format("SELECT TOP 1 [fCounter] FROM [dbo].[t_Counter] WHERE [fDate] < '{0}' ORDER BY [fDate] DESC ", startDate);
                object objStartCounter = SqlHelper.ExecuteScalar(conn, sql);
                startCounter = objStartCounter != null?int.Parse(objStartCounter.ToString()) : 0;

                if (startCounter == 0)
                {
                    CustomDesktopAlert.H2("请输入有效的开始时间!");
                }

                sql = string.Format("SELECT TOP 1 [fCounter] FROM [dbo].[t_Counter] WHERE [fDate] <= '{0}' ORDER BY [fDate] DESC ", endDate);
                object objEndCounter = SqlHelper.ExecuteScalar(conn, sql);
                endCounter = objEndCounter != null?int.Parse(objEndCounter.ToString()) : 0;

                if (endCounter == 0)
                {
                    CustomDesktopAlert.H2("请输入有效的结束时间!");
                }

                int QRCodeCount = endCounter - startCounter;
                CustomDesktopAlert.H2(string.Format("<h2>开始个数:" + startCounter + "<br/>结束个数:" + endCounter + "<br/>共查询到 {0} 条记录</h2>", QRCodeCount.ToString()));
            }
            else
            {
                CustomDesktopAlert.H2("请输入有效的开始时间和结束时间!");
            }
        }
示例#27
0
 private void ButtonQuery_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(baseCondition))
     {
         string queryString = TextBoxX_QueryString.Text;
         if (!string.IsNullOrEmpty(queryString))
         {
             queryCondition   = baseCondition + string.Format(" AND [FDispName] LIKE '%{0}%' ", queryString);
             pager2.PageIndex = 1;
             RefreshGridView();
         }
         else
         {
             CustomDesktopAlert.H2("请输入查询条件!");
         }
     }
     else
     {
         CustomDesktopAlert.H2("请先选择字典类型!");
     }
 }
示例#28
0
        /// <summary>
        /// 更新收到日期
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Button2_Click(object sender, EventArgs e)
        {
            string        AlconNo     = textBox1.Text;
            string        arriveDate  = DateTime.Now.ToShortDateString();
            StringBuilder PoAcception = new StringBuilder();

            PoAcception.Append("update POInStock set FHeadSelfP0342 = '" + arriveDate + "'" + " WHERE FHeadSelfP0341 = '" + AlconNo + "'");

            int retval = SqlHelper.ExecuteNonQuery(conn, PoAcception.ToString());

            if (retval > 0)
            {
                //MessageBox.Show("确认成功 " + retval + " 单!");
                CustomDesktopAlert.H2("确认成功 " + retval + " 单!");
            }
            else
            {
                //MessageBox.Show("确认失败!");
                CustomDesktopAlert.H2("确认失败!");
            }
        }
示例#29
0
        private void LoadModule()
        {
            string myModules = ConfigHelper.ReadValueByKey(ConfigHelper.ConfigurationFile.AppConfig, "Modules");

            if (!string.IsNullOrWhiteSpace(myModules))
            {
                string[] myModule = myModules.Split(';');
                foreach (string module in myModule)
                {
                    if (module.ToLower() == ModuleName.EDI.ToString().ToLower())
                    {
                        rtiEDI.Visible = true;
                        rtiEDI.Select();
                    }
                    else if (module.ToLower() == ModuleName.EDI2.ToString().ToLower())
                    {
                        rtiEDI2.Visible = true;
                        rtiEDI2.Select();
                    }
                    else if (module.ToLower() == ModuleName.DS9208.ToString().ToLower())
                    {
                        rti9208.Visible = true;
                        rti9208.Select();
                    }
                    else if (module.ToLower() == ModuleName.DS9209.ToString().ToLower())
                    {
                        rti9209.Visible = true;
                        rti9209.Select();
                    }
                    else
                    {
                        CustomDesktopAlert.H2(module.ToLower() + "不能识别的应用模块!");
                    }
                }
            }
            else
            {
                CustomDesktopAlert.H2("应用程序加载模块出错!");
            }
        }
示例#30
0
        /// <summary>
        /// 绑定根节点
        /// </summary>
        private void BindingRootTreeNode()
        {
            List <T_SysDictType> lSysDictType = bllSysDictType.GetModelList("FParentId = 0");

            if (lSysDictType.Count > 0)
            {
                foreach (T_SysDictType model in lSysDictType)
                {
                    Node rootNode = new Node(model.FTypeName)
                    {
                        Tag = model.FDictTypeId, Expanded = true
                    };
                    allList = bllSysDictType.GetModelList("");
                    NodesBind(rootNode);
                    advTree1.Nodes.Add(rootNode);
                }
            }
            else
            {
                CustomDesktopAlert.H2("无数据");
            }
        }