Exemplo n.º 1
0
        private void LoadCyy_Click(object sender, EventArgs e)
        {
            DatabaseConnections.GetInstence().UserLogin(cbAccount.Text, tbPassword.Text);

            if (!MainWindow.IS_LOGED_IN)
            {
                MessageBox.Show("请与管理员联系", "帐号或者密码错误", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                //DatabaseConnections.GetInstence().USERID = cbAccount.Text;

                /* 保存密码
                 * if (RemPsw.Checked)
                 * {
                 *  string configFilePath = System.Environment.CurrentDirectory + @"\config\" + cbAccount.Text.Trim() + @".cyy";
                 *  using (FileStream fs = File.Create(configFilePath))
                 *  {
                 *      string tmp = cbAccount.Text.Trim() + "!";
                 *
                 *      tmp += true ? tbPassword.Text.Trim() : "?";
                 *
                 *      byte[] info = new UTF8Encoding(true).GetBytes(tmp);
                 *      fs.Write(info, 0, info.Length);
                 *  }
                 *  File.SetAttributes(configFilePath, FileAttributes.Hidden);
                 * }
                 */
                this.Visible = false;

                (Owner as MainWindow).Visible = true;
                this.Close();
            }
        }
        private void CreateMainDataGridView(DataGridViewColumn[] dgvcArray, string table, string[] queryArray)
        {
            string order = " ORDER BY id ASC ";

            this.MainDataGridView.Columns.Clear();
            this.MainDataGridView.Rows.Clear();

            this.MainDataGridView.Columns.AddRange(dgvcArray);
            List <string[]> resultsList = DatabaseConnections.GetInstence().LocalGetData(table, queryArray, order);

            for (int i = 0; i < resultsList.Count; i++)
            {
                this.MainDataGridView.Rows.Add(resultsList[i]);
            }
        }
Exemplo n.º 3
0
 private void SaveButton_Click(object sender, EventArgs e)
 {
     try
     {
         DatabaseConnections.GetInstence().LocalReplaceIntoData(table, queryArray, FormBasicFeatrues.GetInstence().GetControlsVaule(controlsPreName, detailedPanel, indexCount), mainID);
         if (ItemId.Equals("-1"))
         {
             MessageBox.Show("新建成功!", "恭喜");
         }
         else
         {
             MessageBox.Show("保存成功!", "恭喜");
         }
     }
     catch (Exception ex)
     {
         FormBasicFeatrues.GetInstence().RecordLog(ex, "");
         MessageBox.Show(ex.Message, "错误");
     }
     this.Close();
 }
Exemplo n.º 4
0
        private void InitDetailedInfoWindow()
        {
            int detailedLocationY = 60;
            int detailedHeightDis = 100;

            string[] resultStringArray = new string[] { };

            switch (MainWindow.CURRENT_TAB)
            {
            case 1:
                detailedHeightDis = 200;
                table             = "clients";
                detailedPanel     = DetailedClientPanel;
                queryArray        = new string[] { "id", "sex", "type", "name", "contact", "address", "phone", "taxNumber", "email", "bankInfo", "otherContacts", "PrimaryAccount", "beizhu" };
                controlsPreName   = "tbClient";
                indexCount        = 13;
                mainID            = tbClient1.Text;
                canPrint          = false;
                break;

            case 2:
                detailedHeightDis = 200;
                table             = "goods";
                detailedPanel     = DetailedGoodsPanel;
                queryArray        = new string[] { "id", "dengji", "name", "guige", "unit", "storageName", "storageManager", "storageManagerPhone", "storageLocation", "storageAddress", "initalCount", "purchasePrice", "purchaseTotal", "currentCount", "currntsalesPrice", "currentTotal", "beizhu" };
                controlsPreName   = "tbGoods";
                indexCount        = 17;
                mainID            = tbGoods1.Text;
                canPrint          = false;
                break;

            case 3:
                // 进仓单 出仓单
                detailedHeightDis = 60;
                detailedPanel     = DetailedDanziPanel;
                canPrint          = true;
                danziComboBox.Items.Clear();
                danziComboBox.SelectedIndex = 0;
                danziComboBox.Items.Add("进仓单");
                danziComboBox.Items.Add("出仓单");
                break;

            case 4:
                // 采购单 销售单
                detailedPanel     = DetailedDanziPanel;
                detailedHeightDis = 60;
                danziComboBox.Items.Clear();
                danziComboBox.Items.Add("进仓单");
                danziComboBox.Items.Add("出仓单");
                break;

            case 5:
                detailedPanel     = DetailedDanziPanel;
                detailedHeightDis = 60;

                break;

            /*
             *         default:
             *             detailedHeightDis = 60;
             *             detailedPanel = DetailedDanziPanel;
             *             canPrint = true;
             *             break;
             */
            case 6:
                detailedPanel     = DetailedHTPanel;
                detailedLocationY = 80;
                detailedHeightDis = 60;
                canPrint          = true;
                break;
            }

            if (!ItemId.Equals("-1"))
            {
                try
                {
                    FormBasicFeatrues.GetInstence().SetControlsVaule(controlsPreName, detailedPanel, DatabaseConnections.GetInstence().LocalGetOneRowDataById(table, queryArray, ItemId));
                }
                catch (Exception ex)
                {
                    FormBasicFeatrues.GetInstence().RecordLog(ex, "无法查看详细");
                    MessageBox.Show("无法查看详细" + ex.Message, "错误");
                    this.Close();
                }
            }

            this.Size = new Size(this.Size.Width, this.Size.Height - detailedHeightDis);
            PreviewPrintButton.Location = new Point(PreviewPrintButton.Location.X, PreviewPrintButton.Location.Y - detailedHeightDis);
            SaveButton.Location         = new Point(SaveButton.Location.X, SaveButton.Location.Y - detailedHeightDis);
            detailedPanel.Parent        = this;
            detailedPanel.Location      = new Point(15, 5);
            DetailedTabView.Visible     = false;

            if (!canPrint)
            {
                PreviewPrintButton.Visible = false;
            }
        }