Пример #1
0
        // Добавляет услугу из быстрой кнопки
        private void SelectQuickService(string id)
        {
            tmr.Stop();
            List<string> _content = new List<string>();
            decimal _content_count = 0;
            string _id_serv = "0";
            string _text_serv = "";
            string _stext_serv = "";

            SqlCommand db_command = new SqlCommand("SELECT [id_good], [guid], [name], [description], [type], [apply_form], [sign] FROM [vwGoodList] WHERE [id_good] = '" + id + "'", db_connection);
            SqlDataReader db_reader = db_command.ExecuteReader();
            if (db_reader.Read())
            {
                if (!db_reader.IsDBNull(5))
                {
                    switch (db_reader.GetString(5))
                    {
                        case "00001":
                            {
                                frmApplyService fApply = new frmApplyService(order.Orderno);
                                fApply.ShowDialog();
                                if (fApply.DialogResult == DialogResult.OK)
                                {
                                    _content = fApply.Content;
                                    _content_count = (decimal)_content.Count;
                                }
                                else
                                {
                                    frmQueryCount fCount = new frmQueryCount();
                                    fCount.ShowDialog();
                                    if (fCount.DialogResult == DialogResult.OK)
                                    {
                                        _content_count = fCount.Count;
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                }
                                fApply.Close();
                                break;
                            }
                        case "00002":
                            {
                                frmSelectFrame fApply = new frmSelectFrame();
                                fApply.ShowDialog();
                                if (fApply.DialogResult == DialogResult.OK)
                                {
                                    _content = fApply.Content;
                                    _content_count = fApply.Content_count;
                                }
                                else
                                {
                                    frmQueryCount fCount = new frmQueryCount();
                                    fCount.ShowDialog();
                                    if (fCount.DialogResult == DialogResult.OK)
                                    {
                                        _content_count = fCount.Count;
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                }
                                fApply.Close();
                                break;
                            }
                        case "00003":
                            {
                                frmQueryFrameParam fApply = new frmQueryFrameParam();
                                fApply.ShowDialog();
                                if (fApply.DialogResult == DialogResult.OK)
                                {
                                    _content.Add("\r\nИнформация к заказу:\r\nФайл: " + fApply.txtFile.Text + "\r\nШирина: " + fApply.txtW.Text + "\r\nВысота: " + fApply.txtH.Text + "\r\nПлощадь: " + fApply.txtS.Text + "\r\nКомментарий: \r\n" + fApply.txtComment.Text);
                                    if (prop.Round3)
                                        _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 3);
                                    else
                                        _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 2);
                                }
                                else
                                {
                                    frmQueryCount fCount = new frmQueryCount();
                                    fCount.ShowDialog();
                                    if (fCount.DialogResult == DialogResult.OK)
                                    {
                                        _content_count = fCount.Count;
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                }
                                fApply.Close();
                                break;
                            }
                        case "00004":
                            {
                                frmQueryFrameParam2 fApply = new frmQueryFrameParam2();
                                fApply.ShowDialog();
                                if (fApply.DialogResult == DialogResult.OK)
                                {
                                    _content.Add("\r\nИнформация к заказу:\r\nФайл: " + fApply.txtFile.Text + "\r\nШирина: " + fApply.txtW.Text + "\r\nВысота: " + fApply.txtH.Text + "\r\nПериметр: " + fApply.txtS.Text + "\r\nКомментарий: \r\n" + fApply.txtComment.Text);
                                    if (prop.Round3)
                                        _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 3);
                                    else
                                        _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 2);
                                }
                                else
                                {
                                    frmQueryCount fCount = new frmQueryCount();
                                    fCount.ShowDialog();
                                    if (fCount.DialogResult == DialogResult.OK)
                                    {
                                        _content_count = fCount.Count;
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                }
                                fApply.Close();
                                break;
                            }
                        default:
                            {
                                frmQueryCount fCount = new frmQueryCount();
                                fCount.ShowDialog();
                                if (fCount.DialogResult == DialogResult.OK)
                                {
                                    _content_count = fCount.Count;
                                }
                                else
                                {
                                    _content_count = 0;
                                }
                                break;
                            }
                    }
                }
                else
                {
                    frmQueryCount fCount = new frmQueryCount();
                    fCount.ShowDialog();
                    if (fCount.DialogResult == DialogResult.OK)
                    {
                        _content_count = fCount.Count;
                    }
                    else
                    {
                        _content_count = 0;
                    }
                }
                if (!db_reader.IsDBNull(0))
                    _id_serv = db_reader.GetString(0);
                if (!db_reader.IsDBNull(2))
                    _text_serv = db_reader.GetString(2);
                if (!db_reader.IsDBNull(6))
                    _stext_serv = db_reader.GetString(6);
            }
            if ((_id_serv != "0") && (_content_count > 0))
            {
                AddToServTable(_id_serv, _text_serv, _stext_serv, _content_count, _content);
            }

            db_reader.Close();

            tmr.Start();
        }
Пример #2
0
        private void SelectServ()
        {
            if (!Defect)
            {
                if (gridServices.GetData(gridServices.Row, 1) != null)
                {
                    if (this.add_to_order)
                    {
                        switch (gridServices.GetData(gridServices.Row, 6).ToString())
                        {
                            case "00001":
                                {
                                    frmApplyService fApply;
                                    if(Date!="")
                                        fApply = new frmApplyService(this.orderno, Date);
                                    else
                                        fApply = new frmApplyService(this.orderno);
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        this._content = fApply.Content;
                                        this._content_count = (decimal)this._content.Count;
                                    }
                                    else
                                    {
                                        frmQueryCount fCount = new frmQueryCount();
                                        fCount.ShowDialog();
                                        if (fCount.DialogResult == DialogResult.OK)
                                        {
                                            this._content_count = fCount.Count;
                                        }
                                        else
                                        {
                                            this._content_count = 0;
                                        }
                                    }
                                    fApply.Close();
                                    break;
                                }
                            case "00002":
                                {
                                    frmSelectFrame fApply = new frmSelectFrame();
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        _content = fApply.Content;
                                        _content_count = fApply.Content_count;
                                    }
                                    else
                                    {
                                        frmQueryCount fCount = new frmQueryCount();
                                        fCount.ShowDialog();
                                        if (fCount.DialogResult == DialogResult.OK)
                                        {
                                            _content_count = fCount.Count;
                                        }
                                        else
                                        {
                                            _content_count = 0;
                                        }
                                    }
                                    fApply.Close();
                                    break;
                                }
                            case "00003":
                                {
                                    frmQueryFrameParam fApply = new frmQueryFrameParam();
                                    string dir = "";
                                    try
                                    {
                                        orderno = orderno.Trim();
                                        Order.OrderInfo ord = new Photoland.Order.OrderInfo(db_connection, orderno);
                                        string date = "";
                                        if (ord.Datein != null)
                                            date = ord.Datein;
                                        else
                                            date = DateTime.Now.ToShortDateString();
                                        if (!Directory.Exists(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno))
                                            Directory.CreateDirectory(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno);
                                        if (!Directory.Exists(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno + "\\" + gridServices.GetData(gridServices.Row, 7).ToString().Trim() + "_noscan"))
                                            Directory.CreateDirectory(prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno + "\\" + gridServices.GetData(gridServices.Row, 7).ToString().Trim() + "_noscan");
                                        dir = prop.Dir_print + "\\" + fso.GetDateSubFolders(date) + "\\" + orderno + "\\" + gridServices.GetData(gridServices.Row, 7).ToString().Trim() + "_noscan";

                                    }
                                    catch (Exception ex)
                                    {
                                    }
                                    fApply.lblPath.Text = dir;
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        _content.Add("\r\nИнформация к заказу:\r\nФайл: " + fApply.txtFile.Text + "\r\nШирина: " + fApply.txtW.Text + "\r\nВысота: " + fApply.txtH.Text + "\r\nПлощадь: " + fApply.txtS.Text + "\r\nКомментарий: \r\n" + fApply.txtComment.Text);
                                        if (prop.Round3)
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 3);
                                        else
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 2);
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                    fApply.Close();
                                    break;
                                }
                            case "00004":
                                {
                                    frmQueryFrameParam2 fApply = new frmQueryFrameParam2();
                                    string dir = "";
                                    fApply.lblPath.Text = dir;
                                    fApply.ShowDialog();
                                    if (fApply.DialogResult == DialogResult.OK)
                                    {
                                        _content.Add("\r\nИнформация к заказу:\r\nФайл: " + fApply.txtFile.Text + "\r\nШирина: " + fApply.txtW.Text + "\r\nВысота: " + fApply.txtH.Text + "\r\nПериметр: " + fApply.txtS.Text + "\r\nКомментарий: \r\n" + fApply.txtComment.Text);
                                        if (prop.Round3)
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 3);
                                        else
                                            _content_count = decimal.Round(decimal.Parse(fApply.txtS.Text), 2);
                                    }
                                    else
                                    {
                                        _content_count = 0;
                                    }
                                    fApply.Close();
                                    break;
                                }
                            default:
                                {
                                    frmQueryCount fCount = new frmQueryCount();
                                    fCount.ShowDialog();
                                    if (fCount.DialogResult == DialogResult.OK)
                                    {
                                        this._content_count = fCount.Count;
                                    }
                                    else
                                    {
                                        this._content_count = 0;
                                    }
                                    break;
                                }
                        }
                    }
                }
                _id_serv = gridServices.GetData(gridServices.Row, 1).ToString();
                _text_serv = gridServices.GetData(gridServices.Row, 3).ToString();
                _stext_serv = gridServices.GetData(gridServices.Row, 7).ToString();
                if (this.add_to_order)
                {
                    if ((this._id_serv != "0") && (this._content_count > 0))
                        this.DialogResult = DialogResult.OK;
                    else
                        this.DialogResult = DialogResult.Cancel;
                }
                else
                {
                    if (this._id_serv != "0")
                        this.DialogResult = DialogResult.OK;
                    else
                        this.DialogResult = DialogResult.Cancel;
                }
            }
            else
            {
                frmApplyDefect f = new frmApplyDefect();
                f.db_connection = db_connection;
                f.OrderNo = orderno;
                f.ShowDialog();
                if (f.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    _id_serv = gridServices.GetData(gridServices.Row, 1).ToString();
                    _text_serv = gridServices.GetData(gridServices.Row, 3).ToString();
                    _stext_serv = gridServices.GetData(gridServices.Row, 7).ToString();
                    _defect_count = decimal.Parse(f.txtCount.Text);
                    _defect_type = int.Parse(f.txtType.SelectedValue.ToString());
                    _defect_user = f.txtUser.Text;
                    _defect_user_id = int.Parse(f.txtUser.SelectedValue.ToString());

                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                }
                else
                {
                    this.DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
        }