private void btnUpdate_Click(object sender, EventArgs e)
        {
            if (gvRest.SelectedRows.Count > 0)
            {
                DataGridViewRow row       = gvRest.SelectedRows[0];
                AddForm         updateFrm = new AddForm();
                updateFrm.update = true;


                updateFrm.rest.ID        = (int)row.Cells[0].Value;
                updateFrm.rest.Name      = (string)row.Cells[1].Value;
                updateFrm.rest.Address   = (string)row.Cells[2].Value;
                updateFrm.rest.OpenTime  = (string)row.Cells[3].Value;
                updateFrm.rest.CloseTime = (string)row.Cells[4].Value;
                updateFrm.UpdateRest    += UpdateFrm_UpdateRest;
                this.Hide();
                updateFrm.ShowDialog();

                this.Show();
            }
            else
            {
                MessageBox.Show("No rows has been selected yet\nSelect row not cell!");
            }
        }
        /// <summary>
        /// Do the actual upload to TFS
        /// </summary>
        /// <param name="imageData">byte[] with image data</param>
        /// <returns>TFSResponse</returns>
        public static TFSInfo UploadToTFS(byte[] imageData, string title, string filename, string contentType)
        {
            BackgroundForm backgroundForm = BackgroundForm.ShowAndWait(TFSPlugin.Attributes.Name, Language.GetString("tfs", LangKey.communication_wait));
            AddForm        addForm        = null;

            try
            {
                addForm = new AddForm();
            }
            finally
            {
                backgroundForm.CloseDialog();
            }
            addForm.ImageData   = imageData;
            addForm.Title       = title;
            addForm.Filename    = filename;
            addForm.ContentType = contentType;
            if (addForm.ShowDialog() == DialogResult.OK)
            {
                return(addForm.TFSInfo);
            }
            else
            {
                return(null);
            }
        }
示例#3
0
        private void Add_Button_Click(object sender, EventArgs e)
        {
            AddForm addForm = new AddForm();

            // 先要把主窗口放以弹出窗口中,以便弹出窗口调用主窗口函数
            addForm.setMainForm(this);
            addForm.ShowDialog();
        }
示例#4
0
        private void dodajKorisnika_Click(object sender, EventArgs e)
        {
            AddForm f = new AddForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                BindGrid();
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            var addForm = new AddForm();

            addForm.AddRest += AddForm_AddRest;
            this.Hide();
            addForm.ShowDialog();
            this.Show();
        }
示例#6
0
        public static void AddTask()
        {
            var dialog          = new AddForm();
            var dialogPresenter = new AddTaskPresenter(dialog, repository);
            var result          = dialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                view.UpdateList(repository.GetAllTasks());
            }
        }
示例#7
0
        //Event handler
        private void addToolStripMenuItem_Click(object sender, EventArgs e)
        {
            AddForm addForm = new AddForm(coffeeFlavorList);

            addForm.ShowDialog();
            CoffeeFlavor tempFlavor = addForm.getFlavor();

            if (tempFlavor != null)
            {
                addCoffeeFlavorsToList(tempFlavor);
            }
        }
示例#8
0
        //public Form createForm()
        //{
        //    throw new NotImplementedException();
        //}

        //public Form createForm(IConnector dbConn, string dbName, string tabName)
        //{
        //    throw new NotImplementedException();
        //}

        public Form createForm(IConnector dbConn, string dbName, string tabName, string windowsName, object[] obj)
        {
            BaseForm frm = new AddForm(dbConn, dbName, tabName, windowsName, obj);

            frm.ShowDialog();
            return(frm);

            //FormAddFactoryBuilder builder = new FormAddFactoryBuilder();
            //builder.SetConnectot(dbConn);
            //BaseForm frm = builder.build();
            //frm.ShowDialog();
            //return frm;
        }
示例#9
0
        private void cM_add_Click(object sender, EventArgs e)
        {
            AddForm newForm = new AddForm();

            if (newForm.ShowDialog(this) == DialogResult.OK)
            {
                var selNode = trV_main.SelectedNode;
                if (selNode != null)
                {
                    newForm.NewUser.ContextMenuStrip = cM_edit_delete;
                    selNode?.Nodes.Add(newForm.NewUser);
                }
            }
        }
示例#10
0
        private void AllButtons_Click(object sender, EventArgs e)
        {
            var button = (Button)sender;

            switch (button.Name)
            {
            case "startButton":
                started = true;
                SetStartVisiblity(true);
                startTimeTextBox.Text = DateTime.Now.ToString().Split(' ')[1];
                startDateTextBox.Text = DateTime.Now.ToString().Split(' ')[0];
                break;

            case "endButton":
                ended = true;
                SetEndVisiblity(true);
                endTimeTextBox.Text = DateTime.Now.ToString().Split(' ')[1];
                endDateTextBox.Text = DateTime.Now.ToString().Split(' ')[0];
                break;

            case "cancelButton":
                ended                 = false;
                started               = false;
                startPanel.Visible    = false;
                endButton.Visible     = false;
                endPanel.Visible      = false;
                confirmButton.Visible = false;
                cancelButton.Visible  = false;
                break;

            case "confirmButton":
                int daysInSeconds;
                try
                {
                    DateTime startDateTime = new DateTime(Convert.ToInt32(startDateTextBox.Text.Split('.')[2]), Convert.ToInt32(startDateTextBox.Text.Split('.')[1]), Convert.ToInt32(startDateTextBox.Text.Split('.')[0]),
                                                          Convert.ToInt32(startTimeTextBox.Text.Split(':')[0]), Convert.ToInt32(startTimeTextBox.Text.Split(':')[1]), Convert.ToInt32(startTimeTextBox.Text.Split(':')[2]));

                    DateTime endDateTime = new DateTime(Convert.ToInt32(endDateTextBox.Text.Split('.')[2]), Convert.ToInt32(endDateTextBox.Text.Split('.')[1]), Convert.ToInt32(endDateTextBox.Text.Split('.')[0]),
                                                        Convert.ToInt32(endTimeTextBox.Text.Split(':')[0]), Convert.ToInt32(endTimeTextBox.Text.Split(':')[1]), Convert.ToInt32(endTimeTextBox.Text.Split(':')[2]));

                    TimeSpan differenseDate = endDateTime - startDateTime;

                    if (differenseDate.Days > 0)
                    {
                        daysInSeconds = differenseDate.Days * 24 * 60 * 60;
                    }
                    else
                    {
                        daysInSeconds = 0;
                    }

                    string[] thisSecondsFileNames = new string[5] {
                        "TotalSeconds", "ThisYearSeconds", "ThisMonthSeconds", "ThisWeekSeconds", "TodaySeconds"
                    };

                    foreach (var fileName in thisSecondsFileNames)
                    {
                        Storage.Save(listBox.SelectedItem.ToString(), fileName, Convert.ToString(Convert.ToInt32(Storage.Load(listBox.SelectedItem.ToString(), fileName)) +
                                                                                                 (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds));
                    }

                    //totalSeconds += (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds;
                    //thisYearSeconds += (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds;
                    //thisMonthSeconds += (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds;
                    //thisWeekSeconds += (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds;
                    //todaySeconds += (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds;

                    int    nowSeconds = (differenseDate.Hours * 60 * 60) + (differenseDate.Minutes * 60) + (differenseDate.Seconds) + daysInSeconds;
                    var    seconds    = TimeSpan.FromSeconds(nowSeconds);
                    string spent      = "";
                    if (seconds.Hours != 0)
                    {
                        spent += $"{seconds.Hours} ч. ";
                    }
                    if (seconds.Minutes != 0)
                    {
                        spent += $"{seconds.Minutes} мин. ";
                    }
                    if (seconds.Seconds != 0)
                    {
                        spent += $"{seconds.Seconds} сек.";
                    }
                    if (spent == "")
                    {
                        spent = "0 сек.";
                    }
                    string saveHistory = historyRichTextBox.Text;
                    historyRichTextBox.Text  = "";
                    historyRichTextBox.Text += $"ОТ {startDateTextBox.Text} {startTimeTextBox.Text}\n" +
                                               $"ДО {endDateTextBox.Text} {endTimeTextBox.Text}\n" +
                                               $"ПОТРАЧЕНО {spent}\n\n";
                    historyRichTextBox.Text += saveHistory;

                    TimeSpentForm timeSpentForm1 = new TimeSpentForm(listBox.SelectedItem.ToString());
                    timeSpentForm1.Close();
                }
                catch
                {
                    ended                 = true;
                    started               = true;
                    startPanel.Visible    = true;
                    endButton.Visible     = true;
                    endPanel.Visible      = true;
                    confirmButton.Visible = true;
                    cancelButton.Visible  = true;
                    break;
                }
                ended                 = false;
                started               = false;
                startPanel.Visible    = false;
                endButton.Visible     = false;
                endPanel.Visible      = false;
                confirmButton.Visible = false;
                cancelButton.Visible  = false;
                break;

            case "addButton":
                AddForm addForm = new AddForm();
                addForm.ShowDialog();
                if (addForm.AddedDirectory != null)
                {
                    ShowItemsInListBox();
                    listBox.SelectedItem = addForm.AddedDirectory;
                }
                break;

            case "deleteButton":
                if (listBox.SelectedItem != null)
                {
                    DialogResult dialogResult = MessageBox.Show($"Delete {listBox.SelectedItem} item?", "Deleting", MessageBoxButtons.YesNo);
                    if (dialogResult == DialogResult.Yes)
                    {
                        Storage.DeleteDirectory(listBox.SelectedItem.ToString());
                        ShowItemsInListBox();
                        savedDirectorySelection = null;
                        if (listBox.Items.Count > 0)
                        {
                            listBox.SelectedIndex = 0;
                        }
                        else
                        {
                            mainTableLayoutPanel.Visible    = false;
                            historyTableLayoutPanel.Visible = false;
                        }
                    }
                }
                break;

            case "editButton":
                if (listBox.SelectedItem != null)
                {
                    EditForm editForm = new EditForm(listBox.SelectedItem.ToString());
                    editForm.ShowDialog();

                    ShowItemsInListBox();
                    savedDirectorySelection = editForm.NewDirectoryName;
                    listBox.SelectedItem    = editForm.NewDirectoryName;
                }
                break;

            case "showSpentButton":
                TimeSpentForm timeSpentForm = new TimeSpentForm(listBox.SelectedItem.ToString());
                timeSpentForm.ShowDialog();
                timeSpentForm.Close();
                break;
            }
        }
示例#11
0
        private void cM_edit_Click(object sender, EventArgs e)
        {
            AddForm newForm = new AddForm((MyNodes)trV_main.SelectedNode);

            newForm.ShowDialog();
        }
示例#12
0
 private void Add_Click(object sender, EventArgs e)
 {
     ((AddControl)addForm.Controls[0]).View     = view;
     ((AddControl)addForm.Controls[0]).GridView = gridView;
     addForm.ShowDialog();
 }
示例#13
0
        public bool AddProduct(DataRow[] dr, bool isBarcode, string barcode)
        {
            bool next = false;


            float kg = -1;

            if (isBarcode && dr.Length == 0)
            {
                //object[] obj = getProductWithMassa(barcode);
                //dr = (DataRow[])obj[0];
                //kg = (float)obj[1];
                dr = getProductWithMassa(barcode);
            }

            if (dr.Length != 0)
            {
                DataSetTpos.productRow drP = (DataSetTpos.productRow)dr[0];
                DataRow[] existRows        = DBclass.DS.orders.Select("expenseId=-1 and prodId = " + drP.productId);
                if (existRows.Length > 0)
                {
                    DataSetTpos.ordersRow ordrow = (DataSetTpos.ordersRow)existRows[0];
                    ordrow.packCount = ordrow.packCount + (drP.pack == 0 ? 1 : drP.pack);
                    DataRow drOrder = ordrow;
                    drOrder["sumProduct"] = ordrow.packCount * drP.price / (drP.pack == 0 ? 1 : drP.pack);//ordrow.AcceptChanges();
                }
                else
                {
                    DataSetTpos.ordersRow ordrow = DBclass.DS.orders.NewordersRow();



                    ordrow.prodId = drP.productId;
                    if (drP.pack == 0)
                    {
                        drP.pack = 1;
                    }
                    ordrow.expenseId = -1;
                    int       curPrice = drP.price;
                    OrderForm oform    = new OrderForm(drP);
                    System.Windows.Forms.DialogResult result = oform.ShowDialog();
                    if (result == System.Windows.Forms.DialogResult.OK)
                    {
                        ordrow.packCount = (float)oform.count;
                        DataRow drOrder = ordrow;
                        drOrder["sumProduct"] = oform.sum;//ordrow.packCount * drP.price / (drP.pack == 0 ? 1 : drP.pack);
                        ordrow.orderSumm      = Convert.ToSingle(drOrder["sumProduct"]);

                        //grid.Rows[e.RowIndex].Cells["sumProduct"].Value = (Convert.ToInt32(grid.Rows[e.RowIndex].Cells["packCount"].Value) * Convert.ToInt32(grid.Rows[e.RowIndex].Cells["productPrice"].Value)).ToString();
                    }
                    else if (result == System.Windows.Forms.DialogResult.Cancel)
                    {
                        //ordrow.RejectChanges();
                        drP.RejectChanges();
                        return(false);
                    }
                    else
                    {
                        if (drP.price == 0)
                        {
                            System.Windows.Forms.MessageBox.Show("Товар на складе отсутствует");
                            drP.RejectChanges();
                        }
                        return(false);
                    }
                    DBclass.DS.orders.AddordersRow(ordrow);
                    if (curPrice != drP.price && drP.price != 0)
                    {
                        productTableAdapter prda = new productTableAdapter();
                        prda.Update(drP);
                        return(true);
                    }
                }
                if (isNewExpense)
                {
                    //dgvExpense.Columns["productName"].Visible = true;
                    //dgvExpense.Columns["productPrice"].Visible = true;
                    isNewExpense = false;
                }
                //sumTable();
            }
            else if (isBarcode && UserValues.role == "admin")
            {
                AddForm addForm = new AddForm(barcode);
                if (addForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    //productTableAdapter daProduct = new productTableAdapter();
                    //daProduct.Fill(DBclass.DS.product);
                }
            }

            next = true;
            return(true);
        }
示例#14
0
            //完成预定将预订桌台转为开台
            public static bool CompleteAppoint(string appointno)
            {
                if (MessageBox.Show("确定要完成选中的预定订单,并将预订的桌台状态设为使用吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                {
                    System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
                    conn.ConnectionString = ConnStr;
                    try
                    {
                        SqlCommand selectCMD = new SqlCommand();
                        selectCMD.Connection = conn;
                        conn.Open();

                        string tableno;

                        selectCMD.CommandText = "update appointbill set status='1' where appointno='" + appointno + "'";
                        selectCMD.ExecuteNonQuery();

                        selectCMD.CommandText = "select tableno from view_appointtable where appointno='" + appointno + "'";

                        SqlDataAdapter dbDA = new SqlDataAdapter();
                        dbDA.SelectCommand = selectCMD;
                        DataSet dbDS = new DataSet();
                        dbDA.Fill(dbDS, "t1");

                        //遍历所有当前预订到期的桌台
                        //同一桌台使用相同的 serialno 等同于 并台
                        string serialno;
                        serialno = GenUniqueCode();

                        for (int i = 0; i <= dbDS.Tables[0].Rows.Count - 1; i++)
                        {
                            if (GetTableStatus(dbDS.Tables[0].Rows[i][0].ToString()) == 1) //正在使用中
                            {
                                MessageBox.Show("在当前 " + DateTime.Now.ToShortDateString() + " " + GetSysSetup("CurrentTimeblockName") + " 预订到期的 " + dbDS.Tables[0].Rows[i][0] + " 号桌台正在使用,更新预订操作不能完成!");
                                return false;
                            }
                        }

                        for (int i = 0; i <= dbDS.Tables[0].Rows.Count - 1; i++)
                        {
                            tableno = dbDS.Tables[0].Rows[i][0].ToString();
                            //打开开台、单据录入窗口
                            AddForm addfrm = new AddForm();
                            addfrm.Text = "开台/新建单据";
                            addfrm.frmmode = 1;
                            addfrm.GetConsumeBillTypeList(); //开台新建单据只允许添加消费单据
                            addfrm.TextBox3.Text = GetTableMaxPeopleNumber(tableno); //返回桌台最大载客数
                            addfrm.Label6.Text = addfrm.BillTypeList[0].ToString();
                            addfrm.CurrentBillTypeName = addfrm.BillTypeList[0].ToString();
                            addfrm.Label5.Text = "请为 " + tableno + " 号桌台开台并添加消费单据";

                            addfrm.ShowDialog();
                            if (addfrm.DialogResult == DialogResult.OK)
                            {
                                ExeOpenTable(tableno, int.Parse(addfrm.TextBox3.Text), addfrm.TextBox2.Text);
                                //准备添加第一张单据
                                if (! SameBillinSale(addfrm.TextBox1.Text, addfrm.CurrentBillTypeName))
                                {

                                    AddSaleBill(serialno, tableno, addfrm.TextBox1.Text, GetBillTypeCode(addfrm.CurrentBillTypeName), addfrm.TextBox2.Text);
                                    AddBalanceTable(serialno, tableno, addfrm.TextBox3.Text, addfrm.TextBox2.Text);

                                    //遍历所有当前预订到期的订单菜品,添加到当前单据及桌台中
                                    selectCMD.CommandText = "select foodcode,price,quantity,oprandi,taste from view_appointfood where appointno='" + appointno + "'";
                                    SqlDataAdapter dbDA1 = new SqlDataAdapter();
                                    dbDA1.SelectCommand = selectCMD;
                                    DataSet dbDS1 = new DataSet();
                                    dbDA1.Fill(dbDS1, "t");

                                    for (int j = 0; j <= dbDS1.Tables[0].Rows.Count - 1; j++)
                                    {
                                        AddFoodtoBill(serialno, GenUniqueCode(), addfrm.TextBox1.Text, GetBillTypeCode(addfrm.CurrentBillTypeName), dbDS1.Tables[0].Rows[j][0].ToString(), dbDS1.Tables[0].Rows[j][1].ToString(), System.Convert.ToDouble(dbDS1.Tables[0].Rows[j][2]), 0, dbDS1.Tables[0].Rows[j][3].ToString(), dbDS1.Tables[0].Rows[j][4].ToString(), opinfo.OpID, "", 0);
                                    }

                                }
                                else
                                {
                                    MessageBox.Show("已经存在同类型的单据了");
                                }
                            }
                            else
                            {
                                return false;
                            }
                            addfrm.Dispose();
                        }

                        selectCMD.CommandText = "update appointbill set status='1' where appointno='" + appointno + "'";
                        selectCMD.ExecuteNonQuery();

                        MessageBox.Show("预订转开台操作顺利完成!");
                        return true;

                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString());
                        return false;
                    }
                    finally
                    {
                        conn.Close();
                    }
                }
                return false;
            }
示例#15
0
        private void Button1OnClick(object sender, EventArgs e)
        {
            AddForm control = new AddForm();

            control.ShowDialog(this);
        }
示例#16
0
            //加单
            private void AddBill(string tableno)
            {
                //打开单据录入窗口
                AddForm addfrm = new AddForm();
                addfrm.Text = "添加单据";
                addfrm.frmmode = 0;
                //Dim tableno As String
                //tableno = dgTableStatus.Item(dgTableStatus.CurrentRowIndex, 0)
                CurrentTableNo = tableno;
                //检测当前桌台是否有消费单据
                if (rms_var.TableConsumeBillExists(tableno))
                {
                    addfrm.GetBillTypeList();
                    addfrm.Label6.Text = addfrm.BillTypeList[0].ToString();
                    addfrm.CurrentBillTypeName = addfrm.BillTypeList[0].ToString();
                }
                else
                {
                    addfrm.GetConsumeBillTypeList();
                    addfrm.Label6.Text = addfrm.BillTypeList[0].ToString();
                    addfrm.CurrentBillTypeName = addfrm.BillTypeList[0].ToString();
                }

                addfrm.TextBox3.Visible = false;
                addfrm.Label3.Visible = false;
                addfrm.Label5.Text = "请为 " + tableno + " 号桌台加单";

                addfrm.TextBox2.Text = rms_var.opinfo.OpID;
                addfrm.ShowDialog();
                if (addfrm.DialogResult == DialogResult.OK)
                {
                    //准备添加单据
                    if (! rms_var.SameBillinSale(addfrm.TextBox1.Text, addfrm.CurrentBillTypeName))
                    {
                        if (rms_var.AddSaleBill(rms_var.GetCurrentTableSerialNo(tableno), tableno, addfrm.TextBox1.Text, rms_var.GetBillTypeCode(addfrm.CurrentBillTypeName), addfrm.TextBox2.Text))
                        {
                            CurrentBillNo = addfrm.TextBox1.Text;
                            MessageBox.Show("加单操作顺利完成");
                            //刷新桌台的单据列表
                            ShowBill(CurrentTableNo, "last");
                        }
                        else
                        {
                            MessageBox.Show("加单操作失败!已分配的单据号可能已被其他客户端抢先使用,请重新执行加单操作。");
                        }
                    }
                    else
                    {
                        MessageBox.Show("加单操作失败!已经存在同号单据,请重新执行加单操作。");
                    }
                }
            }
示例#17
0
            //开台
            private bool OpenTableAndAddBill(string tableno)
            {
                //打开开台、单据录入窗口
                AddForm addfrm = new AddForm();
                addfrm.Text = "开台/新建单据";
                addfrm.frmmode = 1;
                addfrm.GetConsumeBillTypeList(); //开台新建单据只允许添加消费单据
                addfrm.Label6.Text = addfrm.BillTypeList[0].ToString();
                addfrm.CurrentBillTypeName = addfrm.BillTypeList[0].ToString();
                addfrm.Label5.Text = "请为 " + tableno + " 号桌台开台并添加消费单据";
                addfrm.TextBox2.Text = rms_var.opinfo.OpID;

                addfrm.ShowDialog();
                if (addfrm.DialogResult == DialogResult.OK)
                {
                    rms_var.ExeOpenTable(tableno, int.Parse(addfrm.TextBox3.Text), addfrm.TextBox2.Text);
                    string serialno;
                    serialno = rms_var.GenUniqueCode();
                    rms_var.AddBalanceTable(serialno, tableno, addfrm.TextBox3.Text, addfrm.TextBox2.Text);
                    GetTableList(CurrentTableTypeName);
                    //准备添加第一张单据
                    if (! rms_var.SameBillinSale(addfrm.TextBox1.Text, addfrm.CurrentBillTypeName))
                    {
                        if (rms_var.AddSaleBill(serialno, tableno, addfrm.TextBox1.Text, rms_var.GetBillTypeCode(addfrm.CurrentBillTypeName), addfrm.TextBox2.Text))
                        {
                            CurrentTableNo = tableno;
                            CurrentBillNo = addfrm.TextBox1.Text;
                            CurrentBillTypename = addfrm.CurrentBillTypeName;
                        }
                        else
                        {
                            MessageBox.Show("加单操作失败!已分配的单据号可能已被其他客户端抢先使用,请重新执行加单操作。");
                        }
                    }
                    else
                    {
                        MessageBox.Show("开台已成功但加单失败(存在同号单据),请手动执行加单操作。");
                    }
                    return true;
                }
                else
                {
                    return false;
                }
            }