Beispiel #1
0
 private void FrmMainB_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (!MsgHelper.AskQuestion("确定要退出系统吗?"))
     {
         e.Cancel = true;
     }
 }
        private void btn删除_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSTATUS == 1 || rowData.FSTATUS == 2 || rowData.FSTATUS == 4 || rowData.FSTATUS == 6)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }

            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                if (MsgHelper.AskQuestion("确认要删除选中的单据,以及删除对应的其他关联信息吗?"))
                {
                    //调用发货计划删除接口
                    int res = _service.DeleteGroupByIDs(ids);
                    if (res > 0)
                    {
                        MsgHelper.ShowInformation("删除成功!");
                        this.onSearch();
                    }
                    else if (res == -1)
                    {
                        MsgHelper.ShowInformation("已经生成发货计划的组柜计划无法生成。请先删除对应的发货计划!");
                        this.onSearch();
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("请选择要删除的数据,只能删除未审核的数据");
            }
        }
        private void btn反审_Click(object sender, EventArgs e)
        {
            string ids = "";

            list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSYNCSTATUS < 1)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }


            if (list.Count > 0)
            {
                ids_sh = string.Join(",", list.ToArray());
            }

            if (ids_sh != "")
            {
                optype = "3";



                if (MsgHelper.AskQuestion("点击确认退回到待审核状态,可修改资料!"))
                {
                    if (!backgroundWorker2.IsBusy)
                    {
                        setButton(false);
                        backgroundWorker2.RunWorkerAsync();
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("反审核只能针对已审核并且未同步到厂家的数据,请先勾选您要处理的数据!");
            }
        }
Beispiel #4
0
 private void FrmLogin_KeyDown(object sender, KeyEventArgs e)
 {
     try
     {
         if (e.KeyCode == Keys.Escape)
         {
             if (MsgHelper.AskQuestion("确认退出登录吗?"))
             {
                 Application.Exit();
             }
         }
     }
     catch (Exception ex)
     {
         LogError(ex);
     }
 }
        private void btn反审_Click(object sender, EventArgs e)
        {
            string        ids  = "";
            List <string> list = new List <string>();

            for (int i = 0; i < gridView发货计划列表.RowCount; i++)
            {
                bool b = gridView发货计划列表.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    var rowIndex = gridView发货计划列表.GetDataSourceRowIndex(i);
                    var rowData  = _dataSrouce[rowIndex];
                    if (rowData.FSYNCSTATUS < 1)
                    {
                        list.Add(rowData.FID);
                    }
                }
            }


            if (list.Count > 0)
            {
                ids = string.Join(",", list.ToArray());
            }

            if (ids != "")
            {
                if (MsgHelper.AskQuestion("点击确认退回到待审核状态,可修改资料!"))
                {
                    //调用发货计划删除接口
                    int res = _service.AuditAntiGroupByIDs(ids);
                    if (res > 0)
                    {
                        MsgHelper.ShowInformation("处理成功!");
                        this.onSearch();
                    }
                }
            }
            else
            {
                MsgHelper.ShowError("反审核只能针对已审核并且未同步到厂家的数据,请先勾选您要处理的数据!");
            }
        }
        private void btn保存_Click(object sender, EventArgs e)
        {
            string closereson = "";

            if (IsRowClose)
            {
                if (!MsgHelper.AskQuestion("确定要关闭选择的明细行吗?"))
                {
                    return;
                }

                FrmInput input = new FrmInput();
                if (input.ShowDialog() != DialogResult.OK)
                {
                    return;
                }

                closereson = input.Content;
            }


            int count = 0;
            List <ICPRBILLENTRYMODEL> list = new List <ICPRBILLENTRYMODEL>();

            for (int i = 0; i < gridView请购计划明细.RowCount; i++)
            {
                bool b = gridView请购计划明细.GetRowCellValue(i, "FCHECK").ToBool();
                if (b)
                {
                    string fid = gridView请购计划明细.GetRowCellValue(i, "FID").ToStr();
                    //string commitqty = gridView请购计划明细.GetRowCellValue(i, "FCOMMITQTY").ToStr();
                    string orderremark1 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK1").ToStr();
                    string orderremark2 = gridView请购计划明细.GetRowCellValue(i, "FORDERREMARK2").ToStr();

                    list.Add(new ICPRBILLENTRYMODEL()
                    {
                        FID           = fid,
                        FORDERREMARK1 = orderremark1,
                        FORDERREMARK2 = orderremark2
                    });


                    if (list.Count == 50)
                    {
                        bool ret = _service.CloseSave(list.ToArray(), Global.LoginUser, closereson);
                        if (ret)
                        {
                            list = new List <ICPRBILLENTRYMODEL>();
                        }
                    }

                    count++;
                }
            }

            _service.UpdateICPRBILL(new ICPRBILLMODEL()
            {
                FID = _icprbillid, FIDENTIFICATION = txt标识.Text
            });
            if (SaveAfter != null)
            {
                SaveAfter(null, null);
            }


            if (list.Count == 0)
            {
                this.Close();
                //MsgHelper.ShowError("请勾选要处理的数据!");
                return;
            }

            if (IsRowClose)
            {
                if (MsgHelper.AskQuestion("确定要关闭选择的明细行吗?"))
                {
                    bool ret = _service.CloseSave(list.ToArray(), Global.LoginUser, closereson);
                    if (ret)
                    {
                        MsgHelper.ShowInformation("处理成功!");
                        this.DialogResult = DialogResult.OK;
                    }
                }
            }
            else
            {
                bool ret = _service.ConfirmSave("", list.ToArray(), Global.LoginUser);
                if (ret)
                {
                    MsgHelper.ShowInformation("保存成功!");

                    //this.Close();
                }
            }
        }
Beispiel #7
0
        /// <summary>
        /// 判断是否需要更新程序
        /// </summary>
        /// <returns></returns>
        private static bool Update()
        {
            VerModel verModel = null;
            string   error    = "";
            bool     isUpdate = false;

            if (GetVersion(out verModel, out error))
            {
                if (verModel != null && verModel.VerCode > Global.VersionInterior) //是否内部版本号比当前的大
                {
                    if (verModel.IsMustUpdate)                                     //是否是强制更新
                    {
                        isUpdate = true;
                    }
                    else
                    {
                        if (MsgHelper.AskQuestion("有新的版本发布,是否下载更新?"))
                        {
                            isUpdate = true;
                        }
                        else
                        {
                            return(true);
                        }
                    }

                    if (isUpdate)
                    {
                        //获取需要更新的文件,并且记录在Update.txt文件夹中
                        List <string> list = null;
                        if (GetUpdateFiles(out list, out error))
                        {
                            if (list == null || list.Count == 0)
                            {
                                MsgHelper.ShowError("获取更新文件为空!");
                                return(false);
                            }

                            string path     = Application.ExecutablePath;
                            char   strSplit = '\\';
                            if (path.Contains("\\"))
                            {
                                strSplit = '\\';
                            }
                            else if (path.Contains("/"))
                            {
                                strSplit = '/';
                            }
                            string[] array = path.Split(strSplit);
                            string   name  = array[array.Length - 1].Split('.')[0];
                            using (StreamWriter sw = File.CreateText(Global.UpdatePath))
                            {
                                sw.WriteLine(name);
                                foreach (string str in list)
                                {
                                    sw.WriteLine(str);
                                }
                            }

                            IniHelper.WriteString(Global.IniUrl, "CONFIG", "VerName", verModel.VerName);

                            Process p = new Process();
                            p.StartInfo.UseShellExecute = false;
                            p.StartInfo.FileName        = Application.StartupPath + "\\AutoUpdate.exe";
                            p.Start();
                            Environment.Exit(0);
                            return(false);
                        }
                        else
                        {
                            MsgHelper.ShowError("获取更新文件失败!/r/n" + error);
                        }
                    }
                }
                else
                {
                    return(true);
                }
            }
            else
            {
                MsgHelper.ShowError(error);
            }
            return(false);
        }