private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = OtherUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = OtherUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();

            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType    = "t_updateotherfee";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("f_sellid", go.GetPropertyValue("id").ToString(), false);


                obj.SetPropertyValue("f_feetype", go.GetPropertyValue("f_feetype").ToString(), false);
                obj.SetPropertyValue("f_newfeetype", ui_f_feetype.Text, false);
                obj.SetPropertyValue("f_fee", decimal.Parse(go.GetPropertyValue("f_fee").ToString()), false);
                obj.SetPropertyValue("f_newfee", decimal.Parse(ui_f_fee.Text), false);
                obj.SetPropertyValue("f_payfeevalid", go.GetPropertyValue("f_payfeevalid").ToString(), false);
                obj.SetPropertyValue("f_newpayfeevalid", ui_payfeevalid.SelectedValue, false);

                obj.SetPropertyValue("f_sellinggasoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_sellinggasdate", ui_handplandate.SelectedDate, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.Name = "t_updateotherfee";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }
            //MessageBox.Show(go.GetPropertyValue("id").ToString());
            //  MessageBox.Show(ui_handplandate.SelectedDate.ToString());
            //oughtfee shifoujiaofei f_operator f_inputtor f_zhinajindate
            string sql = "update t_otherfee set f_feetype= '" + ui_f_feetype.Text +
                         "',f_fee=" + decimal.Parse(ui_f_fee.Text) + ",f_payfeevalid='" + ui_payfeevalid.SelectedValue +
                         "' where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();

            action.HQL           = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name          = "abc";
            action.Invoke();

            //如果数据有误,页面提示
            //回调页面保存按钮功能
            BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;

            save.State = State.End;
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;

            save1.IsOld = true;
            updatehandplan.New();
        }
Esempio n. 2
0
        //打印
        public void PrintD()
        {
            PageIndex = -1;
            Count     = (List.Count % PageRow == 0) ? (List.Count / PageRow) : (List.Count / PageRow) + 1;
            if (Count == 0)
            {
                return;
            }
            int           c  = list.Count;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += (o, e) =>
            {
                PrintDocument pd1 = (PrintDocument)o;
                if (pd1.PrintedPageCount - 1 != PageIndex)
                {
                    return;
                }
                if (List is PagedObjectList)
                {
                    PageIndex++;
                    PagedObjectList pol = (PagedObjectList)List;
                    pol.DataLoaded += (o1, e1) =>
                    {
                        //加载展示数据
                        go.CopyDataFrom(List[0]);
                        e.PageVisual = DataArea;
                        DataArea.UpdateLayout();
                        //打印完成,重置索引
                        if (PageIndex == Count - 1)
                        {
                            e.HasMorePages = false;
                        }
                        else
                        {
                            e.HasMorePages = true;
                        }
                    };
                    pol.PageIndex = PageIndex;
                }
            };
            pd.Print("");
        }
Esempio n. 3
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = SellUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = SellUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();

            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType    = "t_updatesellinggas";

                obj.SetPropertyValue("f_userid", go.GetPropertyValue("f_userid") + "", false);
                obj.SetPropertyValue("f_newuserid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", go.GetPropertyValue("f_username") + "", false);
                obj.SetPropertyValue("f_newusername", ui_username.Text, false);
                obj.SetPropertyValue("f_address", go.GetPropertyValue("f_address") + "", false);
                obj.SetPropertyValue("f_newaddress", ui_address.Text, false);
                obj.SetPropertyValue("f_districtname", go.GetPropertyValue("f_districtname") + "", false);
                obj.SetPropertyValue("f_newdistrictname", ui_f_districtname.Text, false);

                obj.SetPropertyValue("f_sellid", go.GetPropertyValue("id").ToString(), false);
                obj.SetPropertyValue("f_usertype", ui_usertype.Text, false);
                if (go.GetPropertyValue("f_zhinajin") == null)
                {
                    go.SetPropertyValue("f_zhinajin", 0.0m, false);
                }
                obj.SetPropertyValue("f_zhinajin", decimal.Parse(go.GetPropertyValue("f_zhinajin").ToString()), false);
                if (ui_f_zhinajin.Text.ToString().Equals(""))
                {
                    ui_f_zhinajin.Text = "0";
                }

                obj.SetPropertyValue("f_newzhinajin", decimal.Parse(ui_f_zhinajin.Text), false);
                if (go.GetPropertyValue("f_amountmaintenance") == null)
                {
                    go.SetPropertyValue("f_amountmaintenance", 0.0m, false);
                }
                obj.SetPropertyValue("f_weihufei", decimal.Parse(go.GetPropertyValue("f_amountmaintenance").ToString()), false);
                if (ui_f_amountmaintenance.Text.ToString().Equals(""))
                {
                    ui_f_amountmaintenance.Text = "0";
                }

                obj.SetPropertyValue("f_newweihufei", decimal.Parse(ui_f_amountmaintenance.Text), false);
                obj.SetPropertyValue("f_shifouyouxiao", go.GetPropertyValue("f_payfeevalid").ToString(), false);
                obj.SetPropertyValue("f_newshifouyouxiao", ui_f_payfeevalid.Text, false);
                obj.SetPropertyValue("f_pregas", decimal.Parse(go.GetPropertyValue("f_pregas").ToString()), false);
                obj.SetPropertyValue("f_newpregas", decimal.Parse(ui_f_pregas.Text), false);
                obj.SetPropertyValue("f_preamount", decimal.Parse(go.GetPropertyValue("f_preamount").ToString()), false);
                obj.SetPropertyValue("f_newpreamount", decimal.Parse(ui_f_preamount.Text), false);
                obj.SetPropertyValue("f_shoukuan", decimal.Parse(go.GetPropertyValue("f_grossproceeds").ToString()), false);
                obj.SetPropertyValue("f_newshoukuan", decimal.Parse(ui_f_grossproceeds.Text), false);
                if (go.GetPropertyValue("f_benqizhye") == null)
                {
                    go.SetPropertyValue("f_benqizhye", 0.0m, false);
                }
                obj.SetPropertyValue("f_zhye", decimal.Parse(go.GetPropertyValue("f_benqizhye").ToString()), false);
                if (ui_f_benqizhye.Text.ToString().Equals(""))
                {
                    ui_f_benqizhye.Text = "0";
                }

                obj.SetPropertyValue("f_newzhye", decimal.Parse(ui_f_benqizhye.Text), false);

                if (go.GetPropertyValue("f_zhye") == null)
                {
                    go.SetPropertyValue("f_zhye", 0.0m, false);
                }
                obj.SetPropertyValue("f_shangqizhye", decimal.Parse(go.GetPropertyValue("f_zhye").ToString()), false);
                if (ui_f_zhye.Text.ToString().Equals(""))
                {
                    ui_f_zhye.Text = "0";
                }

                obj.SetPropertyValue("f_newshangqizhye", decimal.Parse(ui_f_zhye.Text), false);

                if (go.GetPropertyValue("lastinputgasnum") == null)
                {
                    go.SetPropertyValue("lastinputgasnum", 0.0m, false);
                }
                obj.SetPropertyValue("f_lastinputgasnums", decimal.Parse(go.GetPropertyValue("lastinputgasnum").ToString()), false);
                if (ui_f_zhye.Text.ToString().Equals(""))
                {
                    ui_f_zhye.Text = "0";
                }

                obj.SetPropertyValue("f_newlastinputgasnums", decimal.Parse(ui_f_lastinputgasnums.Text), false);

                if (go.GetPropertyValue("lastrecord") == null)
                {
                    go.SetPropertyValue("lastrecord", 0.0m, false);
                }
                obj.SetPropertyValue("f_lastrecord", decimal.Parse(go.GetPropertyValue("lastrecord").ToString()), false);
                if (ui_f_lastrecord.Text.ToString().Equals(""))
                {
                    ui_f_lastrecord.Text = "0";
                }

                obj.SetPropertyValue("f_newlastrecord", decimal.Parse(ui_f_lastrecord.Text), false);


                obj.SetPropertyValue("f_sellinggasoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_sellinggasdate", ui_handplandate.SelectedDate, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.Name = "t_updatesellinggas";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }
            // BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
            // save.Invoke();

            string sql = "update t_sellinggas set f_zhinajin= " + decimal.Parse(ui_f_zhinajin.Text) +
                         ",f_amountmaintenance=" + decimal.Parse(ui_f_amountmaintenance.Text) +
                         ",f_payfeevalid='" + ui_f_payfeevalid.Text +
                         "',f_pregas=" + decimal.Parse(ui_f_pregas.Text) +
                         ",f_preamount=" + decimal.Parse(ui_f_preamount.Text) +
                         ",f_grossproceeds=" + decimal.Parse(ui_f_grossproceeds.Text) +
                         ",f_benqizhye=" + decimal.Parse(ui_f_benqizhye.Text) +
                         ",f_zhye=" + decimal.Parse(ui_f_zhye.Text) +
                         ",lastinputgasnum=" + decimal.Parse(ui_f_lastinputgasnums.Text) +
                         ",lastrecord=" + decimal.Parse(ui_f_lastrecord.Text) +
                         ",f_userid='" + ui_userid.Text +
                         "',f_payment='" + ui_payment.SelectedValue +
                         "',f_username='******',f_address='" + ui_address.Text +
                         "',f_districtname='" + ui_f_districtname.Text +
                         "'  where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();

            action.HQL           = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name          = "abc";
            action.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;

            save1.IsOld = true;
            updatehandplan.New();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = FaKaUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = FaKaUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();

            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType    = "t_updatemyfaka";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("f_usertype", ui_usertype.Text, false);
                obj.SetPropertyValue("f_qibiaochangjia", ui_gasmetermanufacturers.Text, false);
                obj.SetPropertyValue("f_qibiaopinpai", ui_gaswatchbrand.Text, false);
                obj.SetPropertyValue("f_gaspricetype", ui_f_gaspricetype.Text, false);
                obj.SetPropertyValue("f_newpregas", decimal.Parse(ui_f_pregas.Text), false);
                obj.SetPropertyValue("f_pregas", decimal.Parse(go.GetPropertyValue("f_pregas").ToString()), false);
                obj.SetPropertyValue("f_cardfees", decimal.Parse(go.GetPropertyValue("f_cardfees").ToString()), false);
                obj.SetPropertyValue("f_newcardfees", decimal.Parse(ui_f_cardfees.Text), false);
                obj.SetPropertyValue("f_preamount", decimal.Parse(go.GetPropertyValue("f_preamount").ToString()), false);
                obj.SetPropertyValue("f_newpreamount", decimal.Parse(ui_f_preamount.Text), false);
                obj.SetPropertyValue("f_totalcost", decimal.Parse(go.GetPropertyValue("f_totalcost").ToString()), false);
                obj.SetPropertyValue("f_newtotalcost", decimal.Parse(ui_f_totalcost.Text), false);
                obj.SetPropertyValue("f_whethergivecard", go.GetPropertyValue("f_whethergivecard").ToString(), false);
                obj.SetPropertyValue("f_newwhethergivecard", ui_f_whethergivecard.Text, false);
                obj.SetPropertyValue("f_cardid", ui_f_cardid.Text, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.SetPropertyValue("f_handplanoperator", ui_operator.Text, false);
                obj.SetPropertyValue("f_handplandate", ui_handplandate.SelectedDate, false);
                obj.Name = "t_updatemyfaka";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }


            //oughtfee shifoujiaofei f_operator f_inputtor f_zhinajindate
            string sql = "update t_myfaka set f_pregas= " + decimal.Parse(ui_f_pregas.Text) +
                         ",f_cardfees=" + decimal.Parse(ui_f_cardfees.Text) +
                         ",f_preamount=" + decimal.Parse(ui_f_preamount.Text) +
                         ",f_totalcost=" + decimal.Parse(ui_f_totalcost.Text) +
                         ",f_whethergivecard='" + ui_f_whethergivecard.Text +

                         "'  where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();

            action.HQL           = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name          = "abc";
            action.Invoke();
            //如果数据有误,页面提示
            //回调页面保存按钮功能
            //BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
            // save.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;

            save1.IsOld = true;
            updatehandplan.New();
        }
Esempio n. 5
0
 private void Button_Click1(object sender, RoutedEventArgs e)
 {
     pl = daninfos.ItemsSource as PagedObjectList;
     pl.Save();
 }
Esempio n. 6
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = handUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = handUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();

            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType    = "t_updatehandplan";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("oughtfee", decimal.Parse(go.GetPropertyValue("oughtfee").ToString()), false);
                obj.SetPropertyValue("newoughtfee", decimal.Parse(ui_oughtfee.Text), false);
                if (go.GetPropertyValue("lastinputgasnum") != null)
                {
                    obj.SetPropertyValue("lastinputgasnum", decimal.Parse(go.GetPropertyValue("lastinputgasnum").ToString()), false);
                }
                //修改后上期指数
                if (updatehandplan.GetPropertyValue("lastinputgasnum") != null)
                {
                    obj.SetPropertyValue("newlastinputgasnum", decimal.Parse(updatehandplan.GetPropertyValue("lastinputgasnum").ToString()), false);
                }

                obj.SetPropertyValue("lastrecord", decimal.Parse(go.GetPropertyValue("lastrecord").ToString()), false);
                obj.SetPropertyValue("newlastrecord", decimal.Parse(ui_lastrecord.Text), false);
                obj.SetPropertyValue("shifoujiaofei", go.GetPropertyValue("shifoujiaofei").ToString(), false);
                obj.SetPropertyValue("f_newzhinajindate", ui_zhinajindate.SelectedDate.Value, false);
                //obj.SetPropertyValue("f_zhinajindate", go.GetPropertyValue("f_zhinajindate").ToString(), false);
                obj.SetPropertyValue("newshifoujiaofei", ui_shifoujiaofei.Text, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.SetPropertyValue("lastinputdate", go.GetPropertyValue("lastinputdate"), false);
                obj.SetPropertyValue("newlastinputdate", ui_lastinputdate.SelectedDate, false);
                if (go.GetPropertyValue("f_inputtor") == null)
                {
                    go.SetPropertyValue("f_inputtor", "无", false);
                }
                obj.SetPropertyValue("f_inputtor", go.GetPropertyValue("f_inputtor").ToString(), false);
                obj.SetPropertyValue("f_newinputtor", ui_inputtor.Text, false);
                obj.SetPropertyValue("oughtamount", decimal.Parse(go.GetPropertyValue("oughtamount").ToString()), false);
                obj.SetPropertyValue("newoughtamount", decimal.Parse(ui_oughtamount.Text), false);
                obj.SetPropertyValue("f_handplanoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_handplandate", ui_handplandate.SelectedDate, false);
                obj.Name = "t_updatehandplan";
                //obj.Completed += obj_Completed;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }

            //oughtfee shifoujiaofei f_operator f_inputtor f_zhinajindate
            //拼接更新sql
            string sql = "update t_handplan set lastrecord= " + decimal.Parse(ui_lastrecord.Text) +
                         ",oughtfee=" + decimal.Parse(ui_oughtfee.Text) +
                         ",shifoujiaofei='" + ui_shifoujiaofei.Text +
                         "',f_operator='" + ui_operator.Text +
                         "',f_inputtor='" + ui_inputtor.Text +
                         "',f_zhinajindate='" + ui_zhinajindate.SelectedDate.ToString().Substring(0, 10) +
                         "',f_meterstate='" + meterstate.SelectedValue.ToString() +
                         "',oughtamount=" + decimal.Parse(ui_oughtamount.Text);

            if (updatehandplan.GetPropertyValue("lastinputgasnum") != null)
            {
                sql += ",lastinputgasnum=" + updatehandplan.GetPropertyValue("lastinputgasnum").ToString();
            }
            sql += "  where id = " + go.GetPropertyValue("id");
            HQLAction action = new HQLAction();

            action.HQL           = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name          = "abc";
            action.Invoke();
            //如果数据有误,页面提示
            //回调页面保存按钮功能
            //BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;
            // save.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;

            save1.IsOld = true;
            updatehandplan.New();
        }
Esempio n. 7
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = handUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = handUserUnit.DataContext as GeneralObject;
            //新建对象,往t_updatehandplan插入数据
            GeneralObject obj = new GeneralObject();

            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType    = "t_updatehandplan";
                obj.SetPropertyValue("f_userinfoid", ui_userinfoid.Text, false);
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                if (go.GetPropertyValue("lastinputgasnum") != null)
                {
                    obj.SetPropertyValue("lastinputgasnum", decimal.Parse(go.GetPropertyValue("lastinputgasnum").ToString()), false);
                }
                //修改后上期指数
                if (updatehandplan.GetPropertyValue("lastinputgasnum") != null)
                {
                    obj.SetPropertyValue("newlastinputgasnum", decimal.Parse(updatehandplan.GetPropertyValue("lastinputgasnum").ToString()), false);
                }

                obj.SetPropertyValue("lastrecord", decimal.Parse(go.GetPropertyValue("lastrecord").ToString()), false);
                obj.SetPropertyValue("newlastrecord", decimal.Parse(ui_lastrecord.Text), false);
                obj.SetPropertyValue("shifoujiaofei", go.GetPropertyValue("shifoujiaofei").ToString(), false);
                obj.SetPropertyValue("f_newzhinajindate", ui_zhinajindate.SelectedDate.Value, false);
                obj.SetPropertyValue("newshifoujiaofei", ui_shifoujiaofei.Text, false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.SetPropertyValue("lastinputdate", go.GetPropertyValue("lastinputdate"), false);
                obj.SetPropertyValue("newlastinputdate", ui_lastinputdate.SelectedDate, false);
                if (go.GetPropertyValue("f_inputtor") == null)
                {
                    go.SetPropertyValue("f_inputtor", "无", false);
                }
                obj.SetPropertyValue("f_inputtor", go.GetPropertyValue("f_inputtor").ToString(), false);
                obj.SetPropertyValue("f_newinputtor", ui_inputtor.Text, false);
                obj.SetPropertyValue("oughtamount", decimal.Parse(go.GetPropertyValue("oughtamount").ToString()), false);
                obj.SetPropertyValue("newoughtamount", decimal.Parse(ui_oughtamount.Text), false);
                obj.SetPropertyValue("f_handplanoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_handplandate", ui_handplandate.SelectedDate, false);
                obj.Name = "t_updatehandplan";;
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }

            BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;

            save.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;

            save1.IsOld = true;
            updatehandplan.New();
        }
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //拿出datagrid所选数据
            GeneralObject go = handUserUnits.SelectedItem as GeneralObject;
            //拿出页面数据上下文
            GeneralObject updatehandplan = handUserUnit.DataContext as GeneralObject;
            //新建对象,往t_yongshuiliang插入数据
            GeneralObject obj = new GeneralObject();

            try
            {
                obj.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                obj.EntityType    = "t_yongshuiliang";
                obj.SetPropertyValue("f_userid", ui_userid.Text, false);
                obj.SetPropertyValue("f_username", ui_username.Text, false);
                obj.SetPropertyValue("f_address", ui_address.Text, false);
                obj.SetPropertyValue("oughtfee", double.Parse(go.GetPropertyValue("oughtfee").ToString()), false);
                obj.SetPropertyValue("newoughtfee", double.Parse(ui_oughtfee.Text), false);
                obj.SetPropertyValue("f_updatenote", ui_updatenote.Text, false);
                obj.SetPropertyValue("lastinputdate", go.GetPropertyValue("lastinputdate"), false);
                obj.SetPropertyValue("newlastinputdate", ui_lastinputdate.SelectedDate, false);
                obj.SetPropertyValue("oughtamount", double.Parse(go.GetPropertyValue("oughtamount").ToString()), false);
                obj.SetPropertyValue("newoughtamount", double.Parse(ui_oughtamount.Text), false);
                obj.SetPropertyValue("extrazjfee", double.Parse(go.GetPropertyValue("extrazjfee").ToString()), false);
                obj.SetPropertyValue("newextrazjfee", double.Parse(ui_f_extraprices.Text), false);
                obj.SetPropertyValue("f_fee", double.Parse(go.GetPropertyValue("f_fee").ToString()), false);
                obj.SetPropertyValue("f_newfee", double.Parse(ui_f_fee.Text), false);
                obj.SetPropertyValue("f_jianshuiliang", double.Parse(ui_jianamount.Text), false);
                obj.SetPropertyValue("f_handplanoperator", ui_handplanoperator.Text, false);
                obj.SetPropertyValue("f_handplandate", ui_handplandate.SelectedDate, false);
                obj.Name = "t_yongshuiliang";
                obj.Save();
            }
            catch (Exception a)
            {
                MessageBox.Show(a.Message);
            }
            //取表具编号
            string    userid  = ui_userid.Text;
            string    id      = go.GetPropertyValue("id").ToString();
            int       pregas  = int.Parse(ui_oughtamount.Text);
            string    sql3    = "update t_extraprices set f_pregas= " + pregas + ",f_extrafee = f_extraprices*(" + pregas + ") where parentid=" + id;
            HQLAction action3 = new HQLAction();

            action3.HQL           = sql3;
            action3.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action3.Name          = "handplan1";
            action3.Invoke();

            string    sql    = "update t_handplan set oughtamount= " + pregas + ",extrazjfee =(select sum(f_extrafee) from t_extraprices where parentid='" + id + "') where id=" + id;
            HQLAction action = new HQLAction();

            action.HQL           = sql;
            action.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
            action.Name          = "t_handplan";
            action.Invoke();

            foreach (GeneralObject ss in handlist)
            {
                string handid         = ss.GetPropertyValue("id").ToString();
                double f_stair1amount = double.Parse(ss.GetPropertyValue("f_stair1amount").ToString());
                double f_stair1fee    = double.Parse(ss.GetPropertyValue("f_stair1fee").ToString());
                double f_stair2amount = double.Parse(ss.GetPropertyValue("f_stair2amount").ToString());
                double f_stair2fee    = double.Parse(ss.GetPropertyValue("f_stair2fee").ToString());
                double f_stair3amount = double.Parse(ss.GetPropertyValue("f_stair3amount").ToString());
                double f_stair3fee    = double.Parse(ss.GetPropertyValue("f_stair3fee").ToString());
                double f_stair4amount = double.Parse(ss.GetPropertyValue("f_stair4amount").ToString());
                double f_stair4fee    = double.Parse(ss.GetPropertyValue("f_stair4fee").ToString());
                double f_allamont     = double.Parse(ss.GetPropertyValue("f_allamont").ToString());
                double oughtfee       = double.Parse(ss.GetPropertyValue("oughtfee").ToString());
                string sql2           = "update t_handplan set f_stair1amount= " + f_stair1amount + ",f_stair1fee= " + f_stair1fee +
                                        ",f_stair2amount= " + f_stair2amount + ",f_stair2fee= " + f_stair2fee +
                                        ",f_stair3amount= " + f_stair3amount + ",f_stair3fee= " + f_stair3fee +
                                        ",f_stair4amount= " + f_stair4amount + ",f_stair4fee= " + f_stair4fee +
                                        ",f_allamont= " + f_allamont + ",oughtfee= " + oughtfee + ",f_fee = extrazjfee + " + oughtfee + " where id=" + handid;
                HQLAction action2 = new HQLAction();
                action2.HQL           = sql2;
                action2.WebClientInfo = Application.Current.Resources["dbclient"] as WebClientInfo;
                action2.Name          = "t_handplan";
                action2.Invoke();
            }
            //如果数据有误,页面提示
            //回调页面保存按钮功能
            BatchExcuteAction save = (from p in loader.Res where p.Name.Equals("SaveAction") select p).First() as BatchExcuteAction;

            save.Invoke();
            PagedObjectList save1 = (from p in loader.Res where p.Name.Equals("personlist") select p).First() as PagedObjectList;

            save1.IsOld = true;
            updatehandplan.New();
        }
Esempio n. 9
0
        //打印
        public void Print()
        {
            PageIndex = -1;
            Count     = (List.Count % PageRow == 0) ? (List.Count / PageRow) : (List.Count / PageRow) + 1;
            if (Count == 0)
            {
                return;
            }
            if (IsPrintPage)
            {
                PagedObjectList pdl = new PagedObjectList();
                pdl.WebClientInfo = List.WebClientInfo;
                pdl.Path          = List.Path;
                pdl.Count         = List.Count;
                pdl.PageSize      = PageRow;
                List = pdl;
            }
            int           c  = list.Count;
            PrintDocument pd = new PrintDocument();

            pd.PrintPage += (o, e) =>
            {
                PrintDocument pd1 = (PrintDocument)o;
                if (pd1.PrintedPageCount - 1 != PageIndex)
                {
                    return;
                }
                if (List is BasePagedList)
                {
                    PageIndex++;
                    BasePagedList pol = (BasePagedList)List;
                    pol.DataLoaded += (o1, e1) =>
                    {
                        //加载展示数据
                        items.CopyFrom(List, 0, this.pageRow);
                        //StackPanel panel = (Area as FrameworkElement).FindName("pageNoPanel") as StackPanel;
                        //// if (panel.Tag.Equals(""))
                        //// {
                        ////     return;
                        //// }
                        ////else
                        //if (panel.Tag.Equals("showPageNo"))
                        //{
                        //    (panel.FindName("pageNo") as TextBlock).Text = "第" + (PageIndex + 1) + "页" + "共" + Count+"页";
                        //}
                        e.PageVisual = Area;
                        area.UpdateLayout();

                        //打印完成,重置索引
                        if (PageIndex == Count - 1)
                        {
                            //(panel.FindName("pageNo") as TextBlock).Text = "";
                            e.HasMorePages = false;
                        }
                        else
                        {
                            e.HasMorePages = true;
                        }
                    };
                    pol.PageIndex = PageIndex;
                }
                else
                {
                    //计算获取的数据开始,截止行
                    pageIndex = 0;
                    PageIndex++;
                    int startRow = (PageIndex - 1) * pageRow;
                    int endRow   = (PageIndex * pageRow) - 1;
                    endRow = endRow > (List.Count - 1) ? (List.Count - 1) : (PageIndex * pageRow) - 1;
                    items.CopyFrom(List, startRow, endRow);
                    e.PageVisual = Area;
                    area.UpdateLayout();
                    //打印完成,重置索引
                    if (PageIndex == Count)
                    {
                        e.HasMorePages = false;
                        PageIndex      = 0;
                    }
                    else
                    {
                        e.HasMorePages = true;
                    }
                }
            };
            pd.Print("");
        }