Ejemplo n.º 1
0
 /// <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);
     }
 }
Ejemplo n.º 2
0
 /// <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);
     }
 }
Ejemplo n.º 3
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);
            }
        }
Ejemplo n.º 4
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);
            }
        }
Ejemplo n.º 5
0
 /// <summary>
 /// 设置新报价单对象
 /// </summary>
 private void CreateNewQuotationModel()
 {
     PTBQuotation = new PT_B_Quotation();
     PTBQuotation.Quotation_No   = "新单";
     PTBQuotation.Quotation_Date = DateTime.Today;
 }
Ejemplo n.º 6
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);
            }
        }