Esempio n. 1
0
        /// <summary>
        /// 单号手动录入功能
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_tsb_Change_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                TextBlock myBlock = t_tsb_Change.Header as TextBlock;

                if (myBlock.Text == "单号手动录入")
                {
                    //手动生成单号处理
                    myBlock.Text = "单号自动生成";
                    m_IsHand     = true;
                    t_txt_QuotationNo.IsReadOnly = false;
                }
                else
                {
                    myBlock.Text = "单号手动录入";
                    m_IsHand     = false;
                    t_txt_QuotationNo.IsReadOnly = true;
                    t_txt_QuotationNo.Text       = PTBQuotation.Quotation_No;
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 2
0
 /// <summary>
 /// 新建按钮事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_tsb_New_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (m_IsModify)
         {
             MessageResult myResult = XMessageBox.Ask("当前单据尚未保存,是否继续?", this);
             if (myResult == MessageResult.Yes)
             {
                 //设置新报检单对象
                 CreateNewQuotationModel();
                 //对窗体进行赋值
                 LoadControlsValue();
             }
         }
         else
         {
             //设置新报检单对象
             CreateNewQuotationModel();
             //对窗体进行赋值
             LoadControlsValue();
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
 /// <summary>
 /// 树形图选择切换
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_tvw_Module_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
 {
     try
     {
         LoadBusinessData();
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
 /// <summary>
 /// 结束时间值改变事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_dtp_EndDate_ValueChanged(object sender, RoutedEventArgs e)
 {
     try
     {
         BindTreeNode();
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 5
0
        private void XBaseForm_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                BindDateSource();

                BindTypeSource();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
 /// <summary>
 /// 右键点击前事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_pgg_Bill_PreviewMouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         ArrayList statusList = new ArrayList();
         statusList.Add("已入库");
         statusList.Add("回收站");
         statusList.Add("归档");
         XTreeNode myItem    = t_tvw_Module.SelectedItem as XTreeNode;
         string    myTag     = string.Empty;
         string    parentTag = string.Empty;
         if (myItem == null && m_MQuery != null)
         {
             myTag = m_MQuery.BillType;
         }
         else
         {
             myTag = myItem.Tag.ToString();
             if (myItem.Parent != null)
             {
                 parentTag = myItem.Parent.Tag.ToString();
             }
         }
         string billStatus = string.Empty;
         if (myTag == "Q" || parentTag == "Q")
         {
             PT_B_Quotation myModel = (PT_B_Quotation)t_pgg_Bill.SelectedItem;
             statusList.Remove(SetBillStatus(myModel.Bill_Status));
             billStatus = "Q";
         }
         else
         {
             PT_B_Project myModel = (PT_B_Project)t_pgg_Bill.SelectedItem;
             statusList.Remove(SetBillStatus(myModel.Bill_Status));
             billStatus = "P";
         }
         t_tsb_ChangeState.Items.Clear();
         foreach (string status in statusList)
         {
             MenuItem item = new MenuItem();
             item.Header = status;
             item.Tag    = billStatus;
             item.Click += Item_Click;
             t_tsb_ChangeState.Items.Add(item);
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
 /// <summary>
 /// 表格行鼠标双击事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_pgg_Bill_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     try
     {
         if (t_pgg_Bill.SelectedItem == null)
         {
             return;
         }
         XTreeNode myItem    = t_tvw_Module.SelectedItem as XTreeNode;
         string    myTag     = string.Empty;
         string    parentTag = string.Empty;
         if (myItem == null && m_MQuery != null)
         {
             myTag = m_MQuery.BillType;
         }
         else
         {
             myTag = myItem.Tag.ToString();
             if (myItem.Parent != null)
             {
                 parentTag = myItem.Parent.Tag.ToString();
             }
         }
         if (myTag == "Q" || parentTag == "Q")
         {
             PT_B_Quotation myModel = (PT_B_Quotation)t_pgg_Bill.SelectedItem;
             FrmQuotation   myForm  = new FrmQuotation();
             myForm.PTBQuotation = myModel;
             myForm.ShowDialog();
             m_Entities.Dispose();
             m_Entities = new ProjectTrackingEntities();
             RefreshTreeNode();
         }
         else
         {
             PT_B_Project myModel = (PT_B_Project)t_pgg_Bill.SelectedItem;
             FrmProject   myForm  = new FrmProject();
             myForm.PTBProject = myModel;
             myForm.ShowDialog();
             m_Entities.Dispose();
             m_Entities = new ProjectTrackingEntities();
             RefreshTreeNode();
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 8
0
        private void t_btn_Close_Copy_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                CreateDatabase("server=.\\SQLEXPRESS; uid=sa; pwd=sa123456", "ProjectTracking");

                ExecuteSqlFile("server=.\\SQLEXPRESS; uid=sa; pwd=sa123456", @"C:\Users\40326\Documents\Visual Studio 2017\XProject001\ProjectTracking.git\XProject001\XProjectWPF\DataBase\数据库脚本.sql");

                XMessageBox.Enter("创建成功!", this);
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 9
0
 private void t_btn_Login_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         this.Visibility = Visibility.Hidden;
         ManageForm myForm = new ManageForm();
         //Window1 myForm = new Window1();
         myForm.ShowDialog();
         this.Close();
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 10
0
        /// <summary>
        /// 查询按钮点击事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_tsb_Query_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                FrmQuery myForm = new FrmQuery();
                myForm.ShowDialog();
                m_MQuery = myForm.QueryModel;

                QueryMethod();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 11
0
 /// <summary>
 /// 新建报价单窗口
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_btn_New_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         FrmQuotation myForm = new FrmQuotation();
         myForm.ShowDialog();
         m_Entities.Dispose();
         m_Entities = new ProjectTrackingEntities();
         RefreshTreeNode();
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 12
0
 /// <summary>
 /// 保存按钮事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_tsb_Save_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         bool isSuccess = SaveMethod();
         if (isSuccess)
         {
             XMessageBox.Enter("保存成功", this);
             m_IsModify = false;
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 13
0
 /// <summary>
 /// 打开窗口按钮事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void t_btn_Open_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (t_pgg_Bill.SelectedItem == null)
         {
             XMessageBox.Warning("未选中一条单据!", this);
             return;
         }
         t_pgg_Bill_MouseDoubleClick(null, null);
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 14
0
 /// <summary>
 /// 窗体加载事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void XBaseForm_Loaded(object sender, RoutedEventArgs e)
 {
     try
     {
         //绑定树节点
         BindTreeNode();
         //选中首节点
         t_tvw_Module.Focus();
         TreeViewItem myItem = t_tvw_Module.ItemContainerGenerator.ContainerFromIndex(0) as TreeViewItem;
         myItem.IsSelected = true;
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 15
0
        /// <summary>
        /// 生成项目单
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_tsb_CreateProject_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (m_IsModify || t_txt_QuotationNo.Text == "新单")
                {
                    XMessageBox.Enter("当前单据尚未保存,请保存后再操作!", this);
                    return;
                }
                m_IsModify      = false;
                this.Visibility = Visibility.Hidden;

                PT_B_Project myModel = new PT_B_Project();
                myModel.Project_Id         = Guid.NewGuid().ToString("N");
                myModel.Quotation_No       = PTBQuotation.Quotation_No;
                myModel.Quotation_Date     = PTBQuotation.Quotation_Date;
                myModel.Follow_Man         = PTBQuotation.Follow_Man;
                myModel.Product_Model      = PTBQuotation.Product_Model;
                myModel.Project_Name       = PTBQuotation.Project_Name;
                myModel.Price              = PTBQuotation.Price;
                myModel.Is_Tax             = PTBQuotation.Is_Tax;
                myModel.Project_Type       = PTBQuotation.Quotation_Type;
                myModel.Cycle_Time         = PTBQuotation.Cycle_Time;
                myModel.Company_Name       = PTBQuotation.Company_Name;
                myModel.Company_Address    = PTBQuotation.Company_Address;
                myModel.Contact_Man        = PTBQuotation.Contact_Man;
                myModel.Tel                = PTBQuotation.Tel;
                myModel.Email              = PTBQuotation.Email;
                myModel.Fax                = PTBQuotation.Fax;
                myModel.Remark             = PTBQuotation.Remark;
                myModel.Oper_Time          = DateTime.Now;
                myModel.Account_Receivable = PTBQuotation.Price;
                myModel.Profits            = PTBQuotation.Price;
                FrmProject myForm = new FrmProject();
                myForm.PTBProject = myModel;
                myForm.ShowDialog();

                this.Close();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 16
0
        /// <summary>
        /// 窗体加载事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void XBaseForm_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                if (PTBQuotation == null)
                {
                    CreateNewQuotationModel();
                }
                LoadControlsValue();

                Thread myThread = new Thread(SetMenuEnabel);
                myThread.IsBackground = true;
                myThread.Start();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 17
0
        /// <summary>
        /// 项目单窗口双击事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_dge_Project_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            try
            {
                if (t_dge_Project.Items.Count == 0)
                {
                    return;
                }

                this.Visibility = Visibility.Hidden;
                PT_B_Project myModel = (PT_B_Project)t_dge_Project.SelectedItem;
                FrmProject   myForm  = new FrmProject();
                myForm.PTBProject = myModel;
                myForm.ShowDialog();
                this.Close();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 18
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void t_cmb_Date_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         if (t_cmb_Date.SelectedValue.ToString() == "自定义范围")
         {
             t_dtp_EndDate.IsReadOnly   = false;
             t_dtp_StartDate.IsReadOnly = false;
         }
         else
         {
             t_dtp_EndDate.IsReadOnly   = true;
             t_dtp_StartDate.IsReadOnly = true;
             t_dtp_StartDate.Value      = DateTime.Parse("1900-01-01");
             t_dtp_EndDate.Value        = DateTime.Parse("1900-01-01");
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 19
0
 /// <summary>
 /// 窗体关闭前事件
 /// </summary>
 /// <param name="sender">事件对象</param>
 /// <param name="e">事件参数</param>
 private void XBaseForm_Closing(object sender, System.ComponentModel.CancelEventArgs e)
 {
     try
     {
         if (m_IsModify)
         {
             MessageResult myResult = XMessageBox.Select("当前单据已修改,是否保存?", this);
             if (myResult == MessageResult.Yes)
             {
                 SaveMethod();
             }
             else if (myResult == MessageResult.Cancel)
             {
                 e.Cancel = true;
             }
         }
     }
     catch (Exception ex)
     {
         XMessageBox.Exception(ex);
     }
 }
Esempio n. 20
0
        /// <summary>
        /// 复制按钮事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_tsb_Copy_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (m_IsModify || PTBQuotation.Quotation_No == "新单")
                {
                    XMessageBox.Warning("当前单据尚未保存,请保存后再操作!", this);
                    return;
                }
                PT_B_Quotation copyModel = new PT_B_Quotation();
                copyModel.Quotation_Id    = Guid.NewGuid().ToString("N");
                copyModel.Quotation_No    = "新单";
                copyModel.Quotation_Date  = PTBQuotation.Quotation_Date;
                copyModel.Follow_Man      = PTBQuotation.Follow_Man;
                copyModel.Product_Model   = PTBQuotation.Product_Model;
                copyModel.Project_Name    = PTBQuotation.Project_Name;
                copyModel.Price           = PTBQuotation.Price;
                copyModel.Is_Tax          = PTBQuotation.Is_Tax;
                copyModel.Quotation_Type  = PTBQuotation.Quotation_Type;
                copyModel.Cycle_Time      = PTBQuotation.Cycle_Time;
                copyModel.Company_Name    = PTBQuotation.Company_Name;
                copyModel.Company_Address = PTBQuotation.Company_Address;
                copyModel.Contact_Man     = PTBQuotation.Contact_Man;
                copyModel.Tel             = PTBQuotation.Tel;
                copyModel.Email           = PTBQuotation.Email;
                copyModel.Fax             = PTBQuotation.Fax;
                copyModel.Remark          = PTBQuotation.Remark;
                copyModel.Oper_Time       = DateTime.Now;

                PTBQuotation = copyModel;
                LoadControlsValue();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 21
0
        /// <summary>
        ///  改变状态方法
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void Item_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MenuItem myItem = sender as MenuItem;

                if (myItem.Tag.ToString() == "Q")
                {
                    PT_B_Quotation myModel  = (PT_B_Quotation)t_pgg_Bill.SelectedItem;
                    string         mes      = string.Format("确定将此单据状态修改为【{0}】", myItem.Header.ToString());
                    MessageResult  myResult = XMessageBox.Ask(mes, this);
                    if (myResult == MessageResult.Yes)
                    {
                        myModel.Bill_Status = SetBillStatus(myItem.Header.ToString());
                        m_Entities.SaveChanges();
                        RefreshTreeNode();
                    }
                }
                else
                {
                    PT_B_Project  myModel  = (PT_B_Project)t_pgg_Bill.SelectedItem;
                    string        mes      = string.Format("确定将此单据状态修改为【{0}】", myItem.Header.ToString());
                    MessageResult myResult = XMessageBox.Ask(mes, this);
                    if (myResult == MessageResult.Yes)
                    {
                        myModel.Bill_Status = SetBillStatus(myItem.Header.ToString());
                        m_Entities.SaveChanges();
                        RefreshTreeNode();
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// 删除按钮事件
        /// </summary>
        /// <param name="sender">事件对象</param>
        /// <param name="e">事件参数</param>
        private void t_btn_Delete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (t_pgg_Bill.SelectedItem == null)
                {
                    XMessageBox.Warning("未选中一条单据!", this);
                    return;
                }
                XTreeNode myItem    = t_tvw_Module.SelectedItem as XTreeNode;
                string    myTag     = string.Empty;
                string    parentTag = string.Empty;
                if (myItem == null && m_MQuery != null)
                {
                    myTag = m_MQuery.BillType;
                }
                else
                {
                    myTag = myItem.Tag.ToString();
                    if (myItem.Parent != null)
                    {
                        parentTag = myItem.Parent.Tag.ToString();
                    }
                }
                if (myTag == "Q" || parentTag == "Q")
                {
                    PT_B_Quotation myModel = (PT_B_Quotation)t_pgg_Bill.SelectedItem;
                    if (myModel.Bill_Status != "R")
                    {
                        MessageResult myResult = XMessageBox.Ask("确认删除当前选中的单据?", this);

                        if (myResult == MessageResult.Yes)
                        {
                            myModel.Bill_Status = "R";
                            m_Entities.SaveChanges();
                            RefreshTreeNode();
                        }
                    }
                    else
                    {
                        MessageResult myResult = XMessageBox.Ask("确认彻底删除当前选中的单据?", this);
                        if (myResult == MessageResult.Yes)
                        {
                            m_Entities.PT_B_Quotation.Remove(myModel);
                            m_Entities.SaveChanges();
                            RefreshTreeNode();
                        }
                    }
                }
                else
                {
                    PT_B_Project myModel = (PT_B_Project)t_pgg_Bill.SelectedItem;
                    if (myModel.Bill_Status != "R")
                    {
                        MessageResult myResult = XMessageBox.Ask("确认删除当前选中的单据?", this);

                        if (myResult == MessageResult.Yes)
                        {
                            myModel.Bill_Status = "R";
                            m_Entities.SaveChanges();
                            RefreshTreeNode();
                        }
                    }
                    else
                    {
                        MessageResult myResult = XMessageBox.Ask("确认彻底删除当前选中的单据?", this);
                        if (myResult == MessageResult.Yes)
                        {
                            m_Entities.PT_B_Project.Remove(myModel);
                            m_Entities.SaveChanges();
                            RefreshTreeNode();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }
Esempio n. 23
0
        private void t_btn_Query_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                MQuery myModel = new MQuery();

                switch (t_cmb_Date.SelectedValue.ToString())
                {
                case "当天单据":
                    myModel.DateFilterType = DateFilterTypes.Today;
                    break;

                case "当周单据":
                    myModel.DateFilterType = DateFilterTypes.Week;
                    break;

                case "当月单据":
                    myModel.DateFilterType = DateFilterTypes.Month;
                    break;

                case "所有单据":
                    myModel.DateFilterType = DateFilterTypes.All;
                    break;

                case "自定义范围":
                    myModel.DateFilterType = DateFilterTypes.Custom;
                    break;
                }
                if (t_cmb_Type.SelectedIndex == 0)
                {
                    myModel.BillType = "Q";
                }
                else
                {
                    myModel.BillType = "P";
                }

                myModel.BillNo      = t_txt_BillNo.Text.Trim();
                myModel.StartDate   = t_dtp_StartDate.Value;
                myModel.EndDate     = t_dtp_EndDate.Value;
                myModel.FllowMan    = t_txt_FllowMan.Text;
                myModel.ProjectName = t_txt_ProjectName.Text;
                myModel.CompanyName = t_txt_CompanyName.Text;

                ArrayList myList = new ArrayList();
                if (t_chk_Save.IsChecked == true)
                {
                    myList.Add("安全");
                }
                if (t_chk_EMC.IsChecked == true)
                {
                    myList.Add("EMC");
                }
                if (t_chk_Chemis.IsChecked == true)
                {
                    myList.Add("化学");
                }

                string[] type = new string[myList.Count];
                for (int i = 0; i < myList.Count; i++)
                {
                    type[i] = myList[i].ToString();
                }
                myModel.Type = type;
                QueryModel   = myModel;
                this.Close();
            }
            catch (Exception ex)
            {
                XMessageBox.Exception(ex);
            }
        }