Пример #1
0
        public ExpressAuthorization()
        {
            InitializeComponent();
            foreach (var control in this.Controls)
            {
                if (control is Label)
                {
                    var lb = control as Label;
                    lb.BackColor = Color.Transparent;
                }
            }
            string command = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='ExpressDeal'";

            DealUserList = new List <string>();
            DataTable dt       = conn.GetDataTableBySql(command);
            var       DealUser = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in DealUser)
            {
                DealUserList.Add(item);
            }
            this.txtDeal.Text = string.Join(",", DealUserList);

            command        = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='ExpressFinish'";
            FinishUserList = new List <string>();
            dt             = conn.GetDataTableBySql(command);
            var FinishUser = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in FinishUser)
            {
                FinishUserList.Add(item);
            }
            this.txtFinish.Text = string.Join(",", FinishUserList);
        }
Пример #2
0
        private void init()
        {
            DealAuthorizationUserList   = new List <string>();
            FinishAuthorizationUserList = new List <string>();
            string command = string.Empty;

            //查询处理授权人员
            command = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='ExpressDeal'";
            DataTable dt        = conn.GetDataTableBySql(command);
            var       InputUser = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in InputUser)
            {
                DealAuthorizationUserList.Add(item);
            }
            //查询完结授权人员
            command = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='ExpressFinish'";
            dt      = conn.GetDataTableBySql(command);
            var DealUser = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in DealUser)
            {
                FinishAuthorizationUserList.Add(item);
            }

            if (!string.IsNullOrWhiteSpace(UserEntry.Name))
            {
                if (DealAuthorizationUserList.Count() > 0 && DealAuthorizationUserList.Where(v => v == UserEntry.Name).Count() > 0)
                {
                    //this.btnInput.Visible = true;
                    this.btnDeal.Enabled = true;
                }
                else
                {
                    this.btnDeal.Enabled = false;
                }
                if (FinishAuthorizationUserList.Count() > 0 && FinishAuthorizationUserList.Where(v => v == UserEntry.Name).Count() > 0)
                {
                    //this.btnInput.Visible = true;
                    this.btnFinish.Enabled = true;
                }
                else
                {
                    this.btnFinish.Enabled = false;
                }
                if (UserEntry.Name == "管理员")
                {
                    this.btnAu.Enabled = true;
                }
                else
                {
                    this.btnAu.Enabled = false;
                }
            }
        }
Пример #3
0
        private void DrawToolsControlButtonSaveClick(object sender, EventArgs e)
        {
            try
            {
                if (SelectedImage)
                {
                    string command = string.Empty;
                    command = " select \"value\" from \"Value\" where \"id\"=999";
                    dt      = sqlConn.GetDataTableBySql(command);
                    var path = dt.Rows[0][0].ToString();
                    if (!string.IsNullOrWhiteSpace(path))
                    {
                        saveFileDialog.InitialDirectory = path;
                    }
                    //saveFileDialog.
                    if (saveFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        DrawLastImage();
                        string fileName = saveFileDialog.FileName;
                        int    index    = fileName.LastIndexOf('.');
                        string extion   = fileName.Substring(
                            index + 1, fileName.Length - index - 1);
                        extion = extion.ToLower();

                        ImageFormat imageFormat = ImageFormat.Bmp;

                        switch (extion)
                        {
                        case "jpg":
                        case "jpeg":
                            imageFormat = ImageFormat.Jpeg;
                            break;

                        case "png":
                            imageFormat = ImageFormat.Png;
                            break;

                        case "gif":
                            imageFormat = ImageFormat.Gif;
                            break;
                        }
                        //string command = string.Empty;
                        //command = " insert into \"Value\"(\"id\",\"value\") Values(11,'" + saveFileDialog.FileName + "')";
                        //SqlConn sqlConn = new SqlConn();
                        //string message = sqlConn.ExecuteSql(command);
                        Image.Save(saveFileDialog.FileName, imageFormat);
                        Image.Dispose();
                    }
                }
                else
                {
                    MessageBox.Show("请先选择图像。", "截图", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("图片有误:" + ex.Message);
                return;
            }
        }
Пример #4
0
        public ResionInput()
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.DataSource          = ResionList;

            //ProvinceEntry test = new ProvinceEntry();
            //test.provinceName = "广东";
            //test.days = 2;
            //this.ProvinceList.Add(test);
            //ProvinceEntry test1 = new ProvinceEntry();
            //test1.provinceName = "广西";
            //test1.days = 3;
            //this.ProvinceList.Add(test1);
            //this.dataGridView1.bind
            //ProvinceList = new BindingList<ProvinceEntry>();
            string command = string.Empty;

            command = "select * from ResionSet ";
            DataTable dt = conn.GetDataTableBySql(command);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ResionEntry entry = new ResionEntry();
                    entry.Resion = dt.Rows[i]["Resion"].ToString();
                    entry.Days   = int.Parse(dt.Rows[i]["Days"].ToString());
                    this.ResionList.Add(entry);
                }
            }
        }
Пример #5
0
        public AuthorizationSet(List <string> InputUser, List <string> DealUser, List <string> ResionList, List <string> ShopNameList, List <string> DeleteList)
        {
            InitializeComponent();
            ResionList.Remove("");
            ShopNameList.Remove("");
            this.label1.BackColor = Color.Transparent;
            this.label2.BackColor = Color.Transparent;
            this.label3.BackColor = Color.Transparent;
            this.label4.BackColor = Color.Transparent;
            this.label5.BackColor = Color.Transparent;
            this.label6.BackColor = Color.Transparent;
            this.txtInput.Text    = string.Join(",", InputUser);
            this.txtDeal.Text     = string.Join(",", DealUser);
            this.txtDelete.Text   = string.Join(",", DeleteList);
            this.txtResion.Text   = string.Join(",", ResionList);
            this.txtShopName.Text = string.Join(",", ShopNameList);
            string command = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='AlipayNo'";

            AliPayNoList = new List <string>();
            DataTable dt       = conn.GetDataTableBySql(command);
            var       AliPayNo = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in AliPayNo)
            {
                AliPayNoList.Add(item);
            }
            this.txtAlipayNo.Text = string.Join(",", AliPayNoList);
            command         = string.Empty;
            command         = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='UpdatePathUser'";
            PicPathUserList = new List <string>();
            dt = conn.GetDataTableBySql(command);
            var picPath = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in picPath)
            {
                PicPathUserList.Add(item);
            }
            this.txtUpdatePath.Text = string.Join(",", PicPathUserList);
            command       = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='AuditUser'";
            AuditUserList = new List <string>();
            dt            = conn.GetDataTableBySql(command);
            var AuditUser = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in AuditUser)
            {
                AuditUserList.Add(item);
            }
            this.txtAuditUser.Text = string.Join(",", AuditUserList);

            command         = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='PictureUser'";
            PictureUserList = new List <string>();
            dt = conn.GetDataTableBySql(command);
            var PictureUser = dt.Rows[0][0].ToString().Split(',').ToList();

            foreach (var item in PictureUser)
            {
                PictureUserList.Add(item);
            }
            this.tbPictureUser.Text = string.Join(",", PictureUserList);
        }
Пример #6
0
        private void RoadResion()
        {
            List <string> ResionList = new List <string>();

            ResionList.Add("");
            string command = string.Empty;

            command = "select * from ResionSet ";
            DataTable dt = conn.GetDataTableBySql(command);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ResionList.Add(dt.Rows[i]["Resion"].ToString());
                }
            }
            this.cmbResion.DataSource = null;
            this.cmbResion.DataSource = ResionList;
        }
Пример #7
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            List <string>   selectItem   = new List <string>();
            List <CheckBox> checkBoxList = new List <CheckBox>();

            foreach (Control c in Controls)
            {
                if (c is CheckBox)
                {
                    if (((CheckBox)c).Checked == true)
                    {
                        //selectItem.Add(c.Text);
                        checkBoxList.Add((CheckBox)c);
                    }
                }
            }
            if (checkBoxList.Count() > 0)
            {
                checkBoxList = checkBoxList.OrderBy(v => v.TabIndex).ToList();
                foreach (var checkbox in checkBoxList)
                {
                    selectItem.Add(checkbox.Text);
                }
            }
            if (selectItem.Count() > 0)
            {
                string command = string.Empty;
                command = "select * from \"Authorization\" where FunctionName='RepeatTipItem' ";
                DataTable dt    = conn.GetDataTableBySql(command);
                string    item  = string.Join(",", selectItem);
                string    error = string.Empty;
                if (dt.Rows.Count == 0)
                {
                    command = "insert into \"Authorization\"(FunctionName,AuthorizationUser) values('RepeatTipItem','" + item + "')";
                    error   = conn.ExecuteSql(command);
                }
                else
                {
                    command = "update \"Authorization\" set AuthorizationUser='******' where FunctionName='RepeatTipItem'";
                    error   = conn.ExecuteSql(command);
                }
                if (!string.IsNullOrWhiteSpace(error))
                {
                    MessageBox.Show("保存失败,失败原因:" + error);
                }
                else
                {
                    MessageBox.Show("保存成功!");
                    this.Hide();
                }
            }
        }
Пример #8
0
        private void RegisterUser(string userName, string password, string name)
        {
            string command = string.Empty;

            command = "select * from \"User\" where \"UserName\"='" + userName + "'";
            DataTable tb  = sqlConn.GetDataTableBySql(command);
            string    sql = string.Empty;

            sql = " select * from \"User\" where \"Name\"='" + name + "'";
            DataTable tName = sqlConn.GetDataTableBySql(sql);

            if (tb.Rows.Count > 0)
            {
                MessageBox.Show("用户名已经被注册");
                return;
            }
            else if (tName.Rows.Count > 0)
            {
                MessageBox.Show("姓名已经被注册");
                return;
            }
            else
            {
                command = "insert into \"User\"(\"UserName\",\"Password\",\"Name\",\"IsDelete\") values('" + userName + "','" + password + "','" + name + "',1)";
                string message = sqlConn.ExecuteSql(command);
                if (string.IsNullOrWhiteSpace(message))
                {
                    MessageBox.Show("注册成功");
                    this.Hide();
                }
                else
                {
                    MessageBox.Show("注册失败,失败原因:" + message);
                }
            }
        }
Пример #9
0
        public BalanceSet()
        {
            InitializeComponent();
            string    command = " select \"id\" from \"Value\" where \"value\"='balance'";
            DataTable dt      = conn.GetDataTableBySql(command);
            //var balance = dt.Rows[0][0].ToString();
            //if (!string.IsNullOrWhiteSpace(balance))
            //    this.textBox1.Text = balance;
            List <string> AliPayNoList = new List <string>();

            //查询支付宝帐号
            command = " select \"AuthorizationUser\" from \"Authorization\" where \"FunctionName\"='AlipayNo'";
            dt      = conn.GetDataTableBySql(command);
            var AliPayNo = dt.Rows[0][0].ToString().Split(',').ToList();

            AliPayNoList.Add("");
            foreach (var item in AliPayNo)
            {
                AliPayNoList.Add(item);
            }
            this.cmbAilpayNo.DataSource = null;
            this.cmbAilpayNo.DataSource = AliPayNoList;
            this.StartPosition          = FormStartPosition.CenterScreen;
        }
Пример #10
0
        private void Logining()
        {
            string userName = this.txtUserName.Text;
            string password = this.txtPassword.Text;

            if (string.IsNullOrWhiteSpace(userName))
            {
                MessageBox.Show("请输入用户名");
                return;
            }
            else if (string.IsNullOrWhiteSpace(password))
            {
                MessageBox.Show("请输入密码");
                return;
            }
            else
            {
                string    sql = " SELECT   \"UserName\",\"Password\",\"Name\",\"IsDelete\"  FROM  \"User\" where \"UserName\"='" + userName + "' ";
                DataTable dt  = sqlConn.GetDataTableBySql(sql);
                if (dt.Rows.Count > 0)
                {
                    string dataUsername = dt.Rows[0][0].ToString();
                    string dataPassword = dt.Rows[0][1].ToString();
                    string name         = dt.Rows[0][2].ToString();
                    if (userName != dataUsername || password != dataPassword)
                    {
                        MessageBox.Show("用户名或密码不正确");
                        return;
                    }
                    else
                    {
                        var delete = dt.Rows[0][3].ToString();
                        if (delete == "True")
                        {
                            MessageBox.Show("用户无效,请联系管理员!");
                            return;
                        }
                        //MessageBoxTimeout
                        //MessageBox.Show("登录成功");
                        UserEntry.UserName = userName;
                        UserEntry.Name     = name;
                        Main main = new Main();
                        main.Show();
                        this.Hide();
                    }
                }
            }
        }
Пример #11
0
        public ExpressCompanySet()
        {
            InitializeComponent();
            this.dataGridView1.AutoGenerateColumns = false;
            this.dataGridView1.DataSource          = CompanyList;

            string command = string.Empty;

            command = "select * from CompanySet ";
            DataTable dt = conn.GetDataTableBySql(command);

            if (dt.Rows.Count > 0)
            {
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    CompanyEntry entry = new CompanyEntry();
                    entry.CompanyName = dt.Rows[i]["CompanyName"].ToString();
                    entry.ExpressNo   = dt.Rows[i]["ExpressNo"].ToString();
                    this.CompanyList.Add(entry);
                }
            }
        }
Пример #12
0
        private void Search()
        {
            this.tip.Text     = "图片查询中,请稍等";
            this.tip.Visible  = true;
            this.tip.TabIndex = 1;
            FontFamily ff        = new FontFamily(this.tip.Font.Name);
            var        fontStyle = this.tip.Font.Style;

            this.tip.Font      = new Font(ff, 30, fontStyle, GraphicsUnit.World);
            this.tip.BackColor = Color.Transparent;
            System.Windows.Forms.Application.DoEvents();
            string command = string.Empty;

            command = "select * from PicPath where 1=1";
            if (!string.IsNullOrWhiteSpace(this.tbNo.Text))
            {
                command += " and no='" + this.tbNo.Text + "'";
            }
            if (this.timeRefoundFrom.Value != null)
            {
                var timeFrom = this.timeRefoundFrom.Value;
                timeFrom = timeFrom.AddHours(-this.timeRefoundFrom.Value.Hour).AddMinutes(-this.timeRefoundFrom.Value.Minute).AddSeconds(-this.timeRefoundFrom.Value.Second);

                command += " and convert(datetime,uploadTime) >='" + timeFrom.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            if (this.timeRefoundTo.Value != null)
            {
                var timeTo = this.timeRefoundTo.Value;
                timeTo   = timeTo.AddHours(-this.timeRefoundTo.Value.Hour).AddMinutes(-this.timeRefoundTo.Value.Minute).AddSeconds(-this.timeRefoundTo.Value.Second);
                timeTo   = timeTo.AddHours(23).AddMinutes(59).AddSeconds(59);
                command += " and convert(datetime,uploadTime) <='" + timeTo.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            DataTable dt = sqlConn.GetDataTableBySql(command);

            if (dt.Rows.Count > 0)
            {
                List <PicShowEntry> picList   = new List <PicShowEntry>();
                List <Image>        imageList = new List <Image>();
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    PicShowEntry entry = new PicShowEntry();
                    entry.no      = int.Parse(dt.Rows[i]["no"].ToString());
                    entry.picPath = dt.Rows[i]["path"].ToString();
                    entry.picName = dt.Rows[i]["picName"].ToString();
                    picList.Add(entry);
                }
                //var seachList =
                int seq = 1;
                locationX = 0;
                locationY = 0;
                this.panel1.Controls.Clear();
                foreach (var picEntry in picList)
                {
                    picDirPath = picEntry.picPath;
                    //记录图片源路径 双击显示图片时使用
                    imagePathList.Add(picDirPath);
                    //Image image = Image.FromFile(picDirPath);

                    //HttpWebRequest request = (HttpWebRequest)WebRequest.Create(picDirPath);
                    //WebResponse response = request.GetResponse();//获得响应
                    //Image image = Image.FromStream(response.GetResponseStream());

                    System.Net.WebClient web = new System.Net.WebClient();
                    byte[] buffer            = web.DownloadData(picDirPath);
                    web.Dispose();
                    System.IO.MemoryStream ms = new System.IO.MemoryStream(buffer);
                    //Image image = Image.FromStream(ms);


                    //image.Tag = picEntry.picName;
                    ////图片加载到ImageList控件和imageList图片列表
                    //this.imageList1.Images.Add(image);
                    //imageList.Add(image);



                    //Panel pl = new Panel();
                    //PictureBox picBox = new PictureBox();
                    //picBox.Image = Image.FromStream(ms);
                    //picBox.Width = 580;
                    //picBox.Height = 520;
                    //picBox.SizeMode = PictureBoxSizeMode.StretchImage;
                    //pl.Controls.Add(picBox);
                    //Label lb = new Label();
                    //lb.Text = picEntry.picName;
                    //lb.Width = 200;
                    //lb.Location = new Point(200, 521);
                    //pl.Controls.Add(lb);
                    //pl.Width = 600;
                    //pl.Height = 540;
                    //pl.Location = new Point(locationX+5,locationY+5);
                    //locationX += 620;
                    //if (seq % 2 == 0)
                    //{
                    //    locationY += 560;
                    //    locationX = 0;
                    //}
                    //pl.BorderStyle = BorderStyle.FixedSingle;
                    //this.panel1.Controls.Add(pl);
                    //seq++;


                    //Panel pl = new Panel();
                    PictureBox picBox = new PictureBox();
                    picBox.Image         = Image.FromStream(ms);
                    picBox.ImageLocation = picDirPath;
                    picBox.Width         = 580;
                    picBox.Height        = 520;
                    picBox.SizeMode      = PictureBoxSizeMode.StretchImage;

                    Label lb = new Label();
                    lb.Text     = picEntry.picName;
                    lb.Width    = 200;
                    lb.Location = new Point(200, 521);

                    //pl.Width = 600;
                    //pl.Height = 540;
                    //pl.Location = new Point(locationX + 5, locationY + 5);
                    picBox.Location = new Point(locationX + 5, locationY + 5);
                    lb.Location     = new Point(locationX + 230, locationY + 530);
                    locationX      += 620;
                    if (seq % 2 == 0)
                    {
                        locationY += 560;
                        locationX  = 0;
                    }
                    picBox.MouseDoubleClick += new MouseEventHandler(pictureBox1_MouseDoubleClick);
                    this.panel1.Controls.Add(picBox);
                    this.panel1.Controls.Add(lb);
                    //pl.BorderStyle = BorderStyle.FixedSingle;
                    //this.panel1.Controls.Add(pl);
                    seq++;
                }
                //this.imageList1.ColorDepth = ColorDepth.Depth32Bit;


                ////显示文件列表
                //this.listView1.Items.Clear();
                //this.listView1.LargeImageList = this.imageList1;
                //this.listView1.View = View.LargeIcon;        //大图标显示


                ////开始绑定
                //this.listView1.BeginUpdate();
                ////增加图片至ListView控件中
                //for (int i = 0; i < imageList1.Images.Count; i++)
                //{
                //    ListViewItem lvi = new ListViewItem();
                //    lvi.ImageIndex = i;
                //    lvi.Text = picList[i].picName;
                //    this.listView1.Items.Add(lvi);
                //}
                //this.listView1.EndUpdate();
            }
            this.tip.Visible = false;
        }
Пример #13
0
        private void button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "日志文件 (*.xls)|*.xls;*.xlsx";
            openFileDialog.RestoreDirectory = true;
            openFileDialog.FilterIndex      = 1;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string strCon = "Provider=Microsoft.Ace.OleDb.12.0;" + "data source=" + openFileDialog.FileName + ";Extended Properties='Excel 12.0; HDR=NO; IMEX=1'";
                System.Data.OleDb.OleDbConnection myConn = new System.Data.OleDb.OleDbConnection(strCon);
                string strCom = " SELECT * FROM [Sheet1$] ";
                System.Data.OleDb.OleDbDataAdapter myCommand = new System.Data.OleDb.OleDbDataAdapter(strCom, myConn);
                System.Data.DataTable dt = new System.Data.DataTable();
                myCommand.Fill(dt);
                int seqNum = 1;
                allExpressNo = new List <string>();
                for (int i = 1; i < dt.Rows.Count; i++)
                {
                    allExpressNo.Add(dt.Rows[i][3].ToString());
                }

                if (allExpressNo.Count() > 0)
                {
                    int           allApplyCount  = 2900;
                    int           take           = 0;
                    string        command        = string.Empty;
                    int           needApplyCount = allExpressNo.Count();
                    List <string> applyExpress   = new List <string>();
                    List <int>    searchSeq      = new List <int>();
                    hasExpress   = new List <ExpressEntry>();
                    noHasExpress = new List <ExpressEntry>();
                    failExpress  = new List <ExpressEntry>();
                    hasSeq       = 1;
                    noHasSeqNo   = 1;
                    failSeqNo    = 1;
                    while (needApplyCount > 0)
                    {
                        Random rd  = new Random();
                        int    seq = rd.Next(1, 6);
                        while (searchSeq.Where(v => v == seq).Count() > 0)
                        {
                            seq = rd.Next(1, 6);
                        }

                        //查询使用的帐号
                        command = "select * from Accounts where seqNum=" + seq + "";
                        dt      = conn.GetDataTableBySql(command);
                        if (dt.Rows.Count > 0)
                        {
                            var busID           = dt.Rows[0]["businessID"].ToString();
                            var appKey          = dt.Rows[0]["appkey"].ToString();
                            int todayApplyCount = 0;
                            if (!string.IsNullOrWhiteSpace(busID))
                            {
                                //查询该帐号当天申请次数
                                command = "select * from ApplyRecord where businessID=" + busID + " and Datename(year,applDate)+'-'+Datename(month,applDate)+'-'+Datename(day,applDate)='" + DateTime.Today.ToString("yyyy-MM-dd") + "'";
                                int?id = null;
                                dt = conn.GetDataTableBySql(command);
                                if (dt.Rows.Count > 0)
                                {
                                    todayApplyCount = int.Parse(dt.Rows[0]["applyCount"].ToString());
                                    id = int.Parse(dt.Rows[0]["id"].ToString());
                                }
                                //剩余查询总数量
                                int surplusCount = allApplyCount - todayApplyCount;
                                if (surplusCount > 0)
                                {
                                    //当前需要查询且可查询的数量
                                    int vail = surplusCount - needApplyCount;
                                    //查询数量
                                    int thisTimeCount = 0;
                                    if (vail < 0)
                                    {
                                        thisTimeCount = surplusCount;
                                        //当天已经用满的帐号不再使用
                                        searchSeq.Add(seq);
                                    }
                                    else
                                    {
                                        thisTimeCount = needApplyCount;
                                    }
                                    //跳过已查询的的
                                    applyExpress = allExpressNo.Skip(take).Take(thisTimeCount).ToList();
                                    //记录已查询数
                                    take = thisTimeCount;
                                    //减去已查询的数
                                    needApplyCount = needApplyCount - take;

                                    int needUpdateCount = todayApplyCount + take;
                                    //更新数据库已查询的数
                                    if (id.HasValue)
                                    {
                                        command = "update ApplyRecord set applyCount=" + needUpdateCount + " where id=" + id + "";
                                        conn.ExecuteSql(command);
                                    }
                                    else
                                    {
                                        command = "insert into ApplyRecord(businessID,applyCount) values('" + busID + "'," + needUpdateCount + ")";
                                        conn.ExecuteSql(command);
                                    }
                                    this.BusinessID = busID;
                                    this.AppKey     = appKey;
                                    DealExpressNo(applyExpress);
                                }
                            }
                        }
                    }
                    this.dataGridView1.DataSource = null;
                    this.dataGridView2.DataSource = null;
                    this.dataGridView3.DataSource = null;
                    this.dataGridView1.DataSource = this.hasExpress;
                    this.dataGridView2.DataSource = this.noHasExpress;
                    this.dataGridView3.DataSource = this.failExpress;
                }
            }
        }
Пример #14
0
        private void button1_Click(object sender, EventArgs e)
        {
            string command = string.Empty;

            resultList = new List <ResultEntry>();
            command    = "select side,shop,\"order\",buyID,buyDate,sendDate,company,expressNo,province,shopName,status,importDate from ExpressRecord where 1=1 and status!=0 ";
            if (this.timePickFrom.Value != null)
            {
                var timeFrom = this.timePickFrom.Value;
                timeFrom = timeFrom.AddHours(-this.timePickFrom.Value.Hour).AddMinutes(-this.timePickFrom.Value.Minute).AddSeconds(-this.timePickFrom.Value.Second);

                command += " and convert(datetime,importDate) >='" + timeFrom.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            if (this.timePickTo.Value != null)
            {
                var timeTo = this.timePickTo.Value;
                timeTo   = timeTo.AddHours(-this.timePickTo.Value.Hour).AddMinutes(-this.timePickTo.Value.Minute).AddSeconds(-this.timePickTo.Value.Second);
                timeTo   = timeTo.AddHours(23).AddMinutes(59).AddSeconds(59);
                command += " and convert(datetime,importDate) <='" + timeTo.ToString("yyyy-MM-dd HH:mm:ss") + "'";
            }
            switch (this.cmbExpressStatus.Text)
            {
            case "已揽收":
                command += " and status=1";
                break;

            case "已签收":
                command += " and status=4";
                break;

            case "揽收失败":
                command += " and status=5";
                break;

            case "签收失败":
                command += " and status=6";
                break;
            }
            DataTable dt = conn.GetDataTableBySql(command);

            if (dt.Rows.Count > 0)
            {
                int seqNum = 1;
                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    ResultEntry entry = new ResultEntry();
                    entry.seqNum = seqNum;
                    entry.side   = dt.Rows[i][0].ToString();
                    entry.shop   = dt.Rows[i][1].ToString();
                    entry.order  = dt.Rows[i][2].ToString();
                    entry.buyID  = dt.Rows[i][3].ToString();
                    if (!string.IsNullOrEmpty(dt.Rows[i][4].ToString()))
                    {
                        entry.buyDate = DateTime.Parse(dt.Rows[i][4].ToString());
                    }
                    if (!string.IsNullOrEmpty(dt.Rows[i][5].ToString()))
                    {
                        entry.sendDate = DateTime.Parse(dt.Rows[i][5].ToString());
                    }
                    entry.company   = dt.Rows[i][6].ToString();
                    entry.expressNo = dt.Rows[i][7].ToString();
                    entry.province  = dt.Rows[i][8].ToString();
                    entry.shopName  = dt.Rows[i][9].ToString();
                    entry.status    = int.Parse(dt.Rows[i][10].ToString());
                    if (!string.IsNullOrEmpty(dt.Rows[i][11].ToString()))
                    {
                        entry.importDate = DateTime.Parse(dt.Rows[i][11].ToString());
                    }
                    switch (entry.status)
                    {
                    case 1:
                        entry.statusDesc = "已揽收";
                        break;

                    case 4:
                        entry.statusDesc = "已签收";
                        break;

                    case 5:
                        entry.statusDesc = "揽收查询失败";
                        break;

                    case 6:
                        entry.statusDesc = "签收查询失败";
                        break;
                    }
                    resultList.Add(entry);
                    seqNum++;
                }
            }
            this.dataGridView1.DataSource = null;
            this.dataGridView1.DataSource = resultList;
        }
Пример #15
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            string command = string.Empty;

            if (isShowTip == false)
            {
                if (!string.IsNullOrWhiteSpace(this.tbBuyerID.Text))
                {
                    command = string.Empty;
                    command = "select * from \"OrderRecord\" where \"BuyersID\" like '%" + this.tbBuyerID.Text.Trim() + "%' and \"IsDelete\"='False' order by convert(datetime,CreateTime) desc";
                    DataTable dt = conn.GetDataTableBySql(command);
                    if (dt.Rows.Count > 0)
                    {
                        DateTime createTime = DateTime.Parse(dt.Rows[0]["CreateTime"].ToString());
                        var      time       = DateTime.Now - createTime;
                        if (time.TotalDays <= 30)
                        {
                            if (MessageBox.Show("    买家ID已存在退款记录,请核对!是否继续保存?", "提醒", MessageBoxButtons.YesNo) == DialogResult.Yes)
                            {
                            }
                            else
                            {
                                return;
                            }
                            //if(MessageBox.Show("买家ID已存在退款记录,请核对!", "提示"));
                            //return;
                        }
                    }
                }
            }

            if (string.IsNullOrWhiteSpace(this.cmbShopName.Text))
            {
                MessageBox.Show("请输入店铺名称!");
                return;
            }
            if (string.IsNullOrWhiteSpace(this.tbBuyerID.Text))
            {
                MessageBox.Show("请输入买家ID!");
                return;
            }
            if (string.IsNullOrWhiteSpace(this.cmbRefundWay.Text))
            {
                MessageBox.Show("请输入退款方式!");
                return;
            }
            if (this.cmbRefundWay.Text == "支付宝")
            {
                if (string.IsNullOrWhiteSpace(this.tbAlipayNo.Text))
                {
                    MessageBox.Show("请输入支付宝帐号!");
                    return;
                }
                else if (this.tbAlipayNo.Text.Length < 5)
                {
                    MessageBox.Show("支付宝账号应大于5个字符");
                    return;
                }
            }



            int id = 0;

            command = "select max(id) from OrderRecord ";
            DataTable dt1 = conn.GetDataTableBySql(command);

            if (dt1.Rows.Count > 0)
            {
                id = int.Parse(dt1.Rows[0][0].ToString());
            }
            id++;

            string  refundResion = string.Empty;
            decimal amount1      = 0;
            decimal refundAmount = 0;

            detailList = new List <RefundDetail>();
            RefundDetail entry = new RefundDetail();

            entry.orderId = id;
            if (!string.IsNullOrWhiteSpace(this.tbRefundAmount.Text))
            {
                entry.RefundAmount = decimal.Parse(this.tbRefundAmount.Text);
            }
            entry.RefundResoin = this.cmbRefundResoin.Text;
            entry.code         = this.txtCode.Text;
            detailList.Add(entry);
            refundAmount += entry.RefundAmount;
            refundResion  = entry.RefundResoin + "     " + entry.RefundAmount + "     " + entry.code + Environment.NewLine;

            #region 退款原因赋值
            if (!string.IsNullOrWhiteSpace(this.tbCode1.Text) || !string.IsNullOrWhiteSpace(this.tbRefundAmount1.Text) || !string.IsNullOrWhiteSpace(this.cmbRefundResoin1.Text))
            {
                RefundDetail entry1 = new RefundDetail();
                entry1.orderId = id;
                if (!string.IsNullOrWhiteSpace(this.tbRefundAmount1.Text))
                {
                    entry1.RefundAmount = decimal.Parse(this.tbRefundAmount1.Text);
                }
                amount1             = entry1.RefundAmount;
                entry1.RefundResoin = this.cmbRefundResoin1.Text;
                entry1.code         = this.tbCode1.Text;
                refundAmount       += entry1.RefundAmount;
                refundResion       += entry1.RefundResoin + "     " + amount1 + "     " + entry1.code + Environment.NewLine;
                detailList.Add(entry1);
            }
            if (!string.IsNullOrWhiteSpace(this.tbCode2.Text) || !string.IsNullOrWhiteSpace(this.tbRefundAmount2.Text) || !string.IsNullOrWhiteSpace(this.cmbRefundResoin2.Text))
            {
                RefundDetail entry1 = new RefundDetail();
                entry1.orderId = id;
                if (!string.IsNullOrWhiteSpace(this.tbRefundAmount2.Text))
                {
                    entry1.RefundAmount = decimal.Parse(this.tbRefundAmount2.Text);
                }
                amount1             = entry1.RefundAmount;
                entry1.RefundResoin = this.cmbRefundResoin2.Text;
                entry1.code         = this.tbCode2.Text;
                refundAmount       += entry1.RefundAmount;
                refundResion       += entry1.RefundResoin + "     " + amount1 + "     " + entry1.code + Environment.NewLine;
                detailList.Add(entry1);
            }
            if (!string.IsNullOrWhiteSpace(this.tbCode3.Text) || !string.IsNullOrWhiteSpace(this.tbRefundAmount3.Text) || !string.IsNullOrWhiteSpace(this.cmbRefundResoin3.Text))
            {
                RefundDetail entry1 = new RefundDetail();
                entry1.orderId = id;
                if (!string.IsNullOrWhiteSpace(this.tbRefundAmount3.Text))
                {
                    entry1.RefundAmount = decimal.Parse(this.tbRefundAmount3.Text);
                }
                amount1             = entry1.RefundAmount;
                entry1.RefundResoin = this.cmbRefundResoin3.Text;
                entry1.code         = this.tbCode3.Text;
                refundAmount       += entry1.RefundAmount;
                refundResion       += entry1.RefundResoin + "     " + amount1 + "     " + entry1.code + Environment.NewLine;
                detailList.Add(entry1);
            }
            if (!string.IsNullOrWhiteSpace(this.tbCode4.Text) || !string.IsNullOrWhiteSpace(this.tbRefundAmount4.Text) || !string.IsNullOrWhiteSpace(this.cmbRefundResoin4.Text))
            {
                RefundDetail entry1 = new RefundDetail();
                entry1.orderId = id;
                if (!string.IsNullOrWhiteSpace(this.tbRefundAmount4.Text))
                {
                    entry1.RefundAmount = decimal.Parse(this.tbRefundAmount4.Text);
                }
                amount1             = entry1.RefundAmount;
                entry1.RefundResoin = this.cmbRefundResoin4.Text;
                entry1.code         = this.tbCode4.Text;
                refundAmount       += entry1.RefundAmount;
                refundResion       += entry1.RefundResoin + "     " + amount1 + "     " + entry1.code + Environment.NewLine;
                detailList.Add(entry1);
            }
            if (!string.IsNullOrWhiteSpace(this.tbCode5.Text) || !string.IsNullOrWhiteSpace(this.tbRefundAmount5.Text) || !string.IsNullOrWhiteSpace(this.cmbRefundResoin5.Text))
            {
                RefundDetail entry1 = new RefundDetail();
                entry1.orderId = id;
                if (!string.IsNullOrWhiteSpace(this.tbRefundAmount5.Text))
                {
                    entry1.RefundAmount = decimal.Parse(this.tbRefundAmount5.Text);
                }
                amount1             = entry1.RefundAmount;
                entry1.RefundResoin = this.cmbRefundResoin5.Text;
                entry1.code         = this.tbCode5.Text;
                refundAmount       += entry1.RefundAmount;
                refundResion       += entry1.RefundResoin + "     " + amount1 + "     " + entry1.code + Environment.NewLine;
                detailList.Add(entry1);
            }
            #endregion
            //if (this.dataGridView1.Rows.Count > 0)
            //{
            //    foreach (var item in this.dataGridView1.Rows)
            //    {
            //        var gridRow = item as DataGridViewRow;
            //        //var row = gridRow.DataBoundItem as RefundDetail;
            //        if (gridRow.Cells[0].Value != null)
            //        {
            //            if (!string.IsNullOrWhiteSpace(gridRow.Cells[0].Value.ToString()))
            //                amount1 = decimal.Parse(gridRow.Cells[0].Value.ToString());
            //            refundAmount += amount1;
            //            refundResion += gridRow.Cells[2].Value + "     " + amount1 + "     " + gridRow.Cells[1].Value + Environment.NewLine;
            //            RefundDetail entry1 = new RefundDetail();
            //            entry1.orderId = id;
            //            entry1.RefundAmount = amount1;
            //            if (gridRow.Cells[2].Value!=null)
            //            entry1.RefundResoin = gridRow.Cells[2].Value.ToString();
            //            if (gridRow.Cells[1].Value != null)
            //                entry1.code = gridRow.Cells[1].Value.ToString();
            //            detailList.Add(entry1);
            //        }
            //    }

            //}
            //else
            //{
            //    refundAmount = decimal.Parse(this.tbRefundAmount.Text);
            //    refundResion = this.cmbRefundResoin.Text;
            //}
            if (string.IsNullOrWhiteSpace(this.tbRefundAmount.Text) && detailList.Where(v => v.RefundAmount > 0).Count() == 0 && this.cmbRefundWay.Text != "补发")
            {
                MessageBox.Show("请输入退款金额!");
                return;
            }
            if (string.IsNullOrWhiteSpace(this.cmbRefundResoin.Text) && detailList.Where(v => !string.IsNullOrWhiteSpace(v.RefundResoin)).Count() == 0)
            {
                MessageBox.Show("请输入退款原因!");
                return;
            }
            //decimal amount = decimal.Parse(decimal.Parse(this.tbRefundAmount.Text).ToString("F2"));
            decimal amount = 0;
            amount = decimal.Parse(refundAmount.ToString("F2"));
            string status = string.Empty;
            if ((this.cmbRefundWay.Text == "支付宝" && amount >= 15) || (this.cmbRefundResoin.Text == "漏发" && amount > 10))
            {
                status = "待审核";
            }
            else
            {
                status = "未处理";
            }

            //处理录入次数
            int inputCount = this.QueryInputCount(this.tbBuyerID.Text);

            command  = "set IDENTITY_INSERT OrderRecord ON ;";
            command += " insert into \"OrderRecord\"(\"id\",\"Status\",\"ShopName\",\"BuyersID\",\"RefundWay\",\"AlipayNo\",\"RefundAmount\",\"RefundResoin\",\"Remark\",\"CreateUser\",\"IsDelete\",\"PDName1\",\"PDName2\",\"PDName3\",\"PDName4\",\"PDName5\",\"ExpressNo2\",\"ExpressNo3\",InputCount) Values(" + id + ",'" + status + "','" + this.cmbShopName.Text + "','" + this.tbBuyerID.Text + "','" + this.cmbRefundWay.Text + "','" + this.tbAlipayNo.Text + "','" + amount + "','" + refundResion + "','" + this.tbRemark.Text + "','" + this.tbCreateUser.Text + "','false','" + this.tbPdName1.Text + "','" + this.tbPdName2.Text + "','" + this.tbPdName3.Text + "','" + this.tbPdName4.Text + "','" + this.tbExpressNo1.Text + "','" + this.tbExpressNo2.Text + "','" + this.tbExpressNo3.Text + "'," + inputCount + ") ;";
            command += "set IDENTITY_INSERT OrderRecord off;";
            string message = conn.ExecuteSql(command);
            if (!string.IsNullOrWhiteSpace(message))
            {
                MessageBox.Show("保存失败!失败原因:" + message);
            }
            else
            {
                MessageBox.Show("录入成功");
                if (detailList.Count() > 0)
                {
                    foreach (var item in detailList)
                    {
                        command = "insert into RefundDetail(orderId,RefundAmount,RefundResoin,code) values('" + item.orderId + "','" + item.RefundAmount + "','" + item.RefundResoin + "','" + item.code + "')";
                        message = conn.ExecuteSql(command);
                    }
                }

                //this.dataGridView1.DataSource = null;
                //foreach (var item in this.dataGridView1.Rows)
                //{
                //    var gridRow = item as DataGridViewRow;
                //    this.dataGridView1.Rows.Remove(gridRow);
                //}
                this.tbBuyerID.Text      = "";
                this.tbAlipayNo.Text     = "";
                this.tbRefundAmount.Text = "";
                //this.cmbRefundWay.Text = "";
                this.cmbRefundResoin.Text = "";
                this.tbCreateUser.Text    = UserEntry.Name;
                this.tbRemark.Text        = "";
                this.tbPdName1.Text       = "";
                this.tbPdName2.Text       = "";
                this.tbPdName3.Text       = "";
                this.tbPdName4.Text       = "";
                this.tbExpressNo1.Text    = "";
                this.tbExpressNo2.Text    = "";
                this.tbExpressNo3.Text    = "";
                this.tbUp.Text            = "";

                this.tbCode1.Text                   = "";
                this.tbCode2.Text                   = "";
                this.tbCode3.Text                   = "";
                this.tbCode4.Text                   = "";
                this.tbCode5.Text                   = "";
                this.tbRefundAmount1.Text           = "";
                this.tbRefundAmount2.Text           = "";
                this.tbRefundAmount3.Text           = "";
                this.tbRefundAmount4.Text           = "";
                this.tbRefundAmount5.Text           = "";
                this.cmbRefundResoin1.SelectedIndex = 0;
                this.cmbRefundResoin2.SelectedIndex = 0;
                this.cmbRefundResoin3.SelectedIndex = 0;
                this.cmbRefundResoin4.SelectedIndex = 0;
                this.cmbRefundResoin5.SelectedIndex = 0;
                //this.dataGridView1.DataSource = null;
                //while (this.dataGridView1.Rows.Count > 0)
                //{
                //    this.dataGridView1.Rows.RemoveAt(0);
                //}
                ////this.dataGridView1.i
                //this.dataGridView1.Rows.Add();
                //this.dataGridView1.Rows.Add();
                //this.dataGridView1.Rows.Add();
                //this.dataGridView1.Rows.Add();
                //this.dataGridView1.Rows.Add();
                //Input input = new Input(shopNameList, refundWay);
                //this.Hide();
                //input.Show();
                //this.Hide();
            }
        }