Exemple #1
0
        /// <summary>
        /// 显示提示信息
        /// </summary>
        public void ShowTip(string msg, Window parent = null)
        {
            Tip tip = new Tip();

            if (msg.Length > 4)
            {
                tip.Msg.FontSize = 12;
            }
            tip.Msg.Text = msg;
            tip.Owner    = parent;
            if (parent != null)
            {
                tip.Owner = parent;
            }
            tip.ShowDialog();
        }
Exemple #2
0
 private void btnUpdate_Click(object sender, RoutedEventArgs e)
 {
     #region 控件列表集合
     List <Control> con_list = new List <Control>()
     {
         txtStaff,
         txtConsumeData,
         txtRoyaltyType,
         txtPercent,
         txtSettleNum,
         cboState
     };
     #endregion
     foreach (Control item in con_list)
     {
         if (item is TextBox)
         {
             if (((TextBox)item).Text == "")
             {
                 Tip p = new Tip("请把信息填写完整 !");
                 p.ShowDialog();
                 return;
             }
         }
         if (item is ComboBox)
         {
             if (((ComboBox)item).Text == "")
             {
                 Tip p = new Tip("请把信息填写完整 !");
                 p.ShowDialog();
                 return;
             }
         }
     }
     LR.Entity.Royalty royalty = new LR.Entity.Royalty();
     royalty.ID            = this._service.Single(item => item.ConsumeDataID == royalty.ConsumeDataID).ID;
     royalty.StaffID       = this._staffservice.Single(item => item.Name == txtStaff.Text).ID;
     royalty.ConsumeDataID = Guid.Parse(txtConsumeData.Text); //TODO
     royalty.RoyaltyType   = int.Parse(txtRoyaltyType.Text);  //TODO
     royalty.Percent       = decimal.Parse(txtPercent.Text);
     royalty.SettleNum     = int.Parse(txtSettleNum.Text);    //TODO
     royalty.State         = int.Parse(cboState.Text);
     //this._service.Update(royalty.ID, royalty);
     this.InitListView();
 }
        private void btnExtract_Click(object sender, EventArgs e)
        {
            if (this.lvwShow.ItemsSource == null)
            {
                Tip p = new Tip("当前账期没有数据 !");
                p.ShowDialog();
                return;
            }
            System.Windows.Forms.SaveFileDialog sfd = new System.Windows.Forms.SaveFileDialog();
            sfd.DefaultExt = "xls";
            sfd.Filter     = "Excel文件(*.xls)|*.xls";
            sfd.Title      = "导出文件路径";
            if (sfd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                DataTable dt      = IEnumerableHelper.ToDataTable <RoyaltySettleExpendModel>((IEnumerable <RoyaltySettleExpendModel>) this.lvwShow.ItemsSource);
                String[]  columns = { "StaffNo", "StaffName", "Reservation", "Administration", "Cooperation", "Transcend", "WorkGroup", "Total", "Expend", "Self", "Receiver", "Admin", "ExpandTimeStr" };
                String[]  names   = { "员工号", "姓名", "订房奖励", "管理奖励", "协助奖励", "超越奖励", "工作组管理奖励", "总金额", "是否已发", "是否本人领取", "领取人", "操作人", "领取时间" };


                DataRow dr = dt.NewRow();
                dr["StaffName"]      = "总计";
                dr["Reservation"]    = dt.Compute("sum(Reservation)", "");
                dr["Administration"] = dt.Compute("sum(Administration)", "");
                dr["Cooperation"]    = dt.Compute("sum(Cooperation)", "");
                dr["Transcend"]      = dt.Compute("sum(Transcend)", "");
                dr["WorkGroup"]      = dt.Compute("sum(WorkGroup)", "");
                dr["Total"]          = dt.Compute("sum(Total)", "");
                dt.Rows.Add(dr);

                DataView dv = dt.DefaultView;
                dt = dv.ToTable(true, columns);
                for (int i = 0; i < columns.Length; i++)
                {
                    dt.Columns[columns[i]].ColumnName = names[i];
                }
                ExcelHelper.DataTableToExcel(dt, sfd.FileName);
            }
        }