Exemple #1
0
        public T_FB_BORROWAPPLYDETAIL GetInfoById(string masterId)
        {
            BorrowApplyDetailBLL   bll        = new BorrowApplyDetailBLL();
            T_FB_BORROWAPPLYDETAIL DetialList = bll.GetInfoById(masterId);

            return(DetialList != null ? DetialList : null);
        }
Exemple #2
0
        public T_FB_BORROWAPPLYDETAIL GetBorrowApplyDetailByID(string strBorrowApplyDetailId)
        {
            T_FB_BORROWAPPLYDETAIL entRd = new T_FB_BORROWAPPLYDETAIL();

            using (BorrowApplyDetailBLL bllBorrowApplyDetail = new BorrowApplyDetailBLL())
            {
                entRd = bllBorrowApplyDetail.GetBorrowApplyDetailByID(strBorrowApplyDetailId);
                return(entRd);
            }
        }
Exemple #3
0
        void EditForm_Saving(object sender, SavingEventArgs e)
        {
            ObservableCollection <FBEntity> details = this.OrderEntity.GetRelationFBEntities(typeof(T_FB_BORROWAPPLYDETAIL).Name);

            if (details.Count == 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(ErrorMessage.NoDetailInfo);
                return;
            }
            #region 去掉无关的关联
            details.ToList().ForEach(item =>
            {
                T_FB_BORROWAPPLYDETAIL detail = item.Entity as T_FB_BORROWAPPLYDETAIL;
                detail.T_FB_SUBJECT.T_FB_BORROWAPPLYDETAIL.Clear();
                detail.T_FB_SUBJECT.T_FB_BUDGETACCOUNT.Clear();
            });
            #endregion

            List <string> msgs = new List <string>();

            details.ToList().ForEach(item =>
            {
                T_FB_BORROWAPPLYDETAIL detail = item.Entity as T_FB_BORROWAPPLYDETAIL;
                if (detail.BORROWMONEY < 0)
                {
                    string errorMessage = string.Format(ErrorMessage.BudgetMoneyZero, detail.T_FB_SUBJECT.SUBJECTNAME);
                    msgs.Add(errorMessage);
                }
                if (detail.USABLEMONEY.LessThan(detail.BORROWMONEY))
                {
                    msgs.Add(string.Format(ErrorMessage.BorrowMoneyBigger, detail.T_FB_SUBJECT.SUBJECTNAME));
                }
            });
            if (msgs.Count > 0)
            {
                e.Action = Actions.Cancel;
                CommonFunction.ShowErrorMessage(msgs);
            }
        }
Exemple #4
0
 public void AddToT_FB_BORROWAPPLYDETAIL(T_FB_BORROWAPPLYDETAIL t_FB_BORROWAPPLYDETAIL)
 {
     base.AddObject("T_FB_BORROWAPPLYDETAIL", t_FB_BORROWAPPLYDETAIL);
 }
Exemple #5
0
 public static T_FB_BORROWAPPLYDETAIL CreateT_FB_BORROWAPPLYDETAIL(string bORROWAPPLYDETAILID, decimal bORROWMONEY, string cREATEUSERID, global::System.DateTime cREATEDATE, string uPDATEUSERID, global::System.DateTime uPDATEDATE)
 {
     T_FB_BORROWAPPLYDETAIL t_FB_BORROWAPPLYDETAIL = new T_FB_BORROWAPPLYDETAIL();
     t_FB_BORROWAPPLYDETAIL.BORROWAPPLYDETAILID = bORROWAPPLYDETAILID;
     t_FB_BORROWAPPLYDETAIL.BORROWMONEY = bORROWMONEY;
     t_FB_BORROWAPPLYDETAIL.CREATEUSERID = cREATEUSERID;
     t_FB_BORROWAPPLYDETAIL.CREATEDATE = cREATEDATE;
     t_FB_BORROWAPPLYDETAIL.UPDATEUSERID = uPDATEUSERID;
     t_FB_BORROWAPPLYDETAIL.UPDATEDATE = uPDATEDATE;
     return t_FB_BORROWAPPLYDETAIL;
 }
Exemple #6
0
        /// <summary>
        /// 导入借款单
        /// Creator:安凯航
        /// 日期:2011年5月30日
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void btnImportBorrowData_Click(object sender, RoutedEventArgs e)
        {
            //导入时间
            DateTime       createTime = DateTime.Now;
            OpenFileDialog dialog     = new OpenFileDialog()
            {
                Multiselect = false,
                Filter      = "Excel 2007-2010 File(*.xlsx)|*.xlsx"
            };
            bool?userClickedOK = dialog.ShowDialog();

            // Process input if the user clicked OK.
            if (userClickedOK != true)
            {
                return;
            }
            try
            {
                //待保存数据列表
                List <OrderEntity> orders = new List <OrderEntity>();
                #region 读取Excel文件

                XLSXReader     reader     = new XLSXReader(dialog.File);
                List <string>  subItems   = reader.GetListSubItems();
                var            maseters   = reader.GetData(subItems[0]);
                var            listm      = maseters.ToDataSource();
                var            details    = reader.GetData(subItems[1]);
                var            listd      = details.ToDataSource();
                List <dynamic> masterList = new List <dynamic>();
                foreach (var item in listm)
                {
                    dynamic d = item;
                    masterList.Add(d);
                }
                //排除第一行信息
                masterList.Remove(masterList.First());

                List <dynamic> detailList = new List <dynamic>();
                foreach (var item in listd)
                {
                    dynamic d = item;
                    detailList.Add(d);
                }
                //排除第一行信息
                detailList.Remove(detailList.First());

                #endregion

                #region 添加主表
                List <T_FB_BORROWAPPLYMASTER> import = new List <T_FB_BORROWAPPLYMASTER>();
                foreach (var item in masterList)
                {
                    //构造OrderEntity数据
                    OrderEntity oe = new OrderEntity(typeof(T_FB_BORROWAPPLYMASTER));
                    orders.Add(oe);

                    T_FB_BORROWAPPLYMASTER t = oe.FBEntity.Entity as T_FB_BORROWAPPLYMASTER;
                    t.BORROWAPPLYMASTERID   = Guid.NewGuid().ToString();
                    t.BORROWAPPLYMASTERCODE = item.单据号;
                    if (item.借款类型 == "普通借款")
                    {
                        t.REPAYTYPE = 1;
                    }
                    else if (item.借款类型 == "备用金借款")
                    {
                        t.REPAYTYPE = 2;
                    }
                    else if (item.借款类型 == "专项借款")
                    {
                        t.REPAYTYPE = 3;
                    }
                    else
                    {
                        continue;
                    }
                    t.REMARK = item.备注;
                    import.Add(t);
                }

                #endregion

                #region 添加子表

                foreach (var item in detailList)
                {
                    OrderEntity oe = orders.FirstOrDefault(oen =>
                    {
                        T_FB_BORROWAPPLYMASTER bm = oen.FBEntity.Entity as T_FB_BORROWAPPLYMASTER;
                        if (bm.BORROWAPPLYMASTERCODE == item.单据号)
                        {
                            return(true);
                        }
                        else
                        {
                            return(false);
                        }
                    });
                    if (oe == null)
                    {
                        string message = "导入的借款单明细借款单号为\"" + item.单据号 + "\"的明细,没有相应的借款单对应.请检查借款Excel中是否有此借款单的数据";
                        throw new InvalidOperationException(message);
                    }
                    FBEntity fbdetail        = oe.CreateFBEntity <T_FB_BORROWAPPLYDETAIL>();
                    T_FB_BORROWAPPLYDETAIL d = fbdetail.Entity as T_FB_BORROWAPPLYDETAIL;
                    d.BORROWAPPLYDETAILID = Guid.NewGuid().ToString();
                    d.REMARK                 = item.摘要;
                    d.BORROWMONEY            = Convert.ToDecimal(item.借款金额);
                    d.UNREPAYMONEY           = Convert.ToDecimal(item.未还款金额);
                    d.T_FB_SUBJECT           = d.T_FB_SUBJECT ?? new T_FB_SUBJECT();
                    d.T_FB_SUBJECT.SUBJECTID = item.借款科目;
                    d.CREATEDATE             = createTime;
                    d.CREATEUSERID           = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                    d.UPDATEDATE             = createTime;
                    d.UPDATEUSERID           = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                }

                #endregion

                //服务
                OrderEntityService service = new OrderEntityService();

                #region 得到科目信息

                QueryExpression reExp = QueryExpressionHelper.Equal("OWNERID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID);
                QueryExpression exp   = QueryExpressionHelper.Equal("OWNERPOSTID", SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID);
                exp.QueryType         = "T_FB_BORROWAPPLYDETAIL";
                exp.RelatedExpression = reExp;
                exp.IsUnCheckRight    = true;

                #endregion

                #region 获取申请人信息

                ObservableCollection <string> numbers = new ObservableCollection <string>();
                masterList.ForEach(item => numbers.Add(item.申请人身份证号));//拿到所有身份证号
                SMT.Saas.Tools.PersonnelWS.PersonnelServiceClient client = new Saas.Tools.PersonnelWS.PersonnelServiceClient();
                client.GetEmployeesByIdnumberAsync(numbers);

                #endregion

                #region 先获取申请人信息,待申请人信息填充完毕之后进行下一步操作

                client.GetEmployeesByIdnumberCompleted += new EventHandler <Saas.Tools.PersonnelWS.GetEmployeesByIdnumberCompletedEventArgs>((oo, ee) =>
                {
                    if (ee.Error == null)
                    {
                        string message = null;
                        try
                        {
                            masterList.ForEach(m =>
                            {
                                //添加owner和creator
                                SMT.Saas.Tools.PersonnelWS.V_EMPLOYEEVIEW userview = null;
                                try
                                {
                                    userview = ee.Result.First(t => t.IDNUMBER == m.申请人身份证号);
                                }
                                catch (InvalidOperationException ex)
                                {
                                    message = ex.Message + "\n" + "在系统中找不到身份证号为\"" + m.申请人身份证号 + "\"的,员工信息.也可能是您没有相应的权限.";
                                    throw new InvalidOperationException(message);
                                }
                                T_FB_BORROWAPPLYMASTER master = null;
                                try
                                {
                                    master = import.First(t => t.BORROWAPPLYMASTERCODE == m.单据号);
                                }
                                catch (InvalidOperationException ex)
                                {
                                    message = ex.Message + "\n" + "导入的借款单明细借款单号为\"" + m.单据号 + "\"的明细,没有相应的借款单对应.请检查借款Excel中是否有此借款单的数据";
                                    throw new InvalidOperationException(message);
                                }
                                master.OWNERCOMPANYID       = userview.OWNERCOMPANYID;
                                master.OWNERCOMPANYNAME     = userview.OWNERCOMPANYID;
                                master.OWNERDEPARTMENTID    = userview.OWNERDEPARTMENTID;
                                master.OWNERID              = userview.EMPLOYEEID;
                                master.OWNERPOSTID          = userview.OWNERPOSTID;
                                master.CREATECOMPANYID      = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                                master.CREATECOMPANYNAME    = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
                                master.CREATEDEPARTMENTID   = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                                master.CREATEDEPARTMENTNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
                                master.CREATEPOSTID         = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                                master.CREATEPOSTNAME       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostName;
                                master.CREATEUSERID         = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                                master.CREATEUSERNAME       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
                                master.CREATEDATE           = createTime;
                                master.UPDATEUSERID         = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                                master.UPDATEUSERNAME       = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
                                master.UPDATEDATE           = createTime;
                            });
                            //填充完申请人信息之后开始填充科目信息
                            service.QueryFBEntities(exp);
                        }
                        catch (Exception ex)
                        {
                            SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.ConfirmationBoxs("导入出错", ex.Message, "确定", MessageIcon.Exclamation);
                        }
                    }
                });

                #endregion

                #region 填充完申请人信息之后开始填充科目信息

                service.QueryFBEntitiesCompleted += new EventHandler <QueryFBEntitiesCompletedEventArgs>((o, args) =>
                {
                    if (args.Error == null)
                    {
                        //构造明细科目及账务信息
                        string message = null;
                        try
                        {
                            import.ForEach(m =>
                            {
                                OrderEntity oe = orders.FirstOrDefault(oen =>
                                {
                                    T_FB_BORROWAPPLYMASTER bm = oen.FBEntity.Entity as T_FB_BORROWAPPLYMASTER;
                                    if (bm.BORROWAPPLYMASTERCODE == m.BORROWAPPLYMASTERCODE)
                                    {
                                        return(true);
                                    }
                                    else
                                    {
                                        return(false);
                                    }
                                });
                                var dlist = oe.GetRelationFBEntities("T_FB_BORROWAPPLYDETAIL");
                                List <T_FB_BORROWAPPLYDETAIL> detailslist = new List <T_FB_BORROWAPPLYDETAIL>();
                                dlist.ForEach(ddd =>
                                {
                                    detailslist.Add(ddd.Entity as T_FB_BORROWAPPLYDETAIL);
                                });
                                detailslist.ForEach(d =>
                                {
                                    FBEntity en = null;
                                    try
                                    {
                                        en = args.Result.First(a => ((T_FB_BORROWAPPLYDETAIL)a.Entity).T_FB_SUBJECT.SUBJECTCODE == d.T_FB_SUBJECT.SUBJECTID);
                                    }
                                    catch (InvalidOperationException ex)
                                    {
                                        message = ex.Message + "\n" + "导入的借款单明细中,在系统中找不到ID为\"" + d.T_FB_SUBJECT.SUBJECTID + "\"的科目,也可能是您没有相应的权限";
                                        throw new InvalidOperationException(message);
                                    }
                                    T_FB_BORROWAPPLYDETAIL t = en.Entity as T_FB_BORROWAPPLYDETAIL;
                                    if (t != null)
                                    {
                                        t.T_FB_SUBJECT.T_FB_BORROWAPPLYDETAIL.Clear();
                                        d.T_FB_SUBJECT = t.T_FB_SUBJECT;
                                        d.CHARGETYPE   = t.CHARGETYPE;
                                        d.USABLEMONEY  = t.USABLEMONEY;
                                        #region 清理科目信息中的无用数据

                                        t.T_FB_SUBJECT.T_FB_BORROWAPPLYDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_BUDGETACCOUNT.Clear();
                                        t.T_FB_SUBJECT.T_FB_BUDGETCHECK.Clear();
                                        t.T_FB_SUBJECT.T_FB_CHARGEAPPLYDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_COMPANYBUDGETAPPLYDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_COMPANYBUDGETMODDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_COMPANYBUDGETMODDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_COMPANYTRANSFERDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_DEPTBUDGETADDDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_DEPTBUDGETAPPLYDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_DEPTTRANSFERDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_EXTENSIONORDERDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_PERSONBUDGETADDDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_PERSONBUDGETAPPLYDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_PERSONMONEYASSIGNDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_REPAYAPPLYDETAIL.Clear();
                                        t.T_FB_SUBJECT.T_FB_SUBJECTCOMPANY.Clear();
                                        t.T_FB_SUBJECT.T_FB_SUBJECTDEPTMENT.Clear();
                                        t.T_FB_SUBJECT.T_FB_SUBJECTPOST.Clear();
                                        t.T_FB_SUBJECT.T_FB_TRAVELEXPAPPLYDETAIL.Clear();

                                        #endregion
                                    }
                                });
                            });

                            //保存
                            service.SaveList(orders);
                        }
                        catch (Exception ex)
                        {
                            SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.ConfirmationBoxs("导入出错", ex.Message, "确定", MessageIcon.Exclamation);
                        }
                    }
                });

                #endregion

                #region 所有信息构造完成之后保存数据

                service.SaveListCompleted += new EventHandler <ActionCompletedEventArgs <bool> >((s, evgs) =>
                {
                    if (evgs.Result)
                    {
                        SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.ConfirmationBox("导入成功", "导入成功", "确定");
                    }
                    else
                    {
                        SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.ConfirmationBox("导入失败", "导入失败", "确定");
                    }
                });

                #endregion
            }
            catch (Exception ex)
            {
                SMT.SaaS.FrameworkUI.ChildWidow.ComfirmWindow.ConfirmationBoxs("导入出错", ex.Message, "确定", MessageIcon.Exclamation);
            }
        }
Exemple #7
0
        private void InnerSaveBorrowApply(T_FB_BORROWAPPLYMASTER borrowMaster)
        {
            borrowMaster.CREATECOMPANYID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
            borrowMaster.CREATECOMPANYNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
            borrowMaster.CREATEDATE = DateTime.Now;
            borrowMaster.CREATEDEPARTMENTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
            borrowMaster.CREATEDEPARTMENTNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
            borrowMaster.CREATEPOSTID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
            borrowMaster.CREATEPOSTNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostName;
            borrowMaster.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            borrowMaster.CREATEUSERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
            borrowMaster.EDITSTATES = 0;
            borrowMaster.OWNERCOMPANYID = strOwnerCompanyID;
            borrowMaster.OWNERCOMPANYNAME = strOwnerCompanyName;
            borrowMaster.OWNERDEPARTMENTID = strOwnerDepartmentID;
            borrowMaster.OWNERDEPARTMENTNAME = strOwnerDepartmentName;
            borrowMaster.OWNERID = strOwnerID;
            borrowMaster.OWNERNAME = strOwnerName;
            borrowMaster.OWNERPOSTID = strOwnerPostID;
            borrowMaster.OWNERPOSTNAME = strOwnerPostName;
            borrowMaster.ISREPAIED = 0;
           
            if (string.IsNullOrEmpty(RepayDate.Text))
            {
                borrowMaster.PLANREPAYDATE = null;
            }
            else
            {
                borrowMaster.PLANREPAYDATE = DateTime.Parse(RepayDate.Text);
            }
            if (txtCode.Text.IndexOf('>') > 0)
            {
                borrowMaster.BORROWAPPLYMASTERCODE = " ";
            }
            else
            {
                borrowMaster.BORROWAPPLYMASTERCODE = txtCode.Text;
            }
            if (nBorrowType==1)//普通借款
            {
                #region 费用报销情况
                if (this.rbSelf.IsChecked.Value)
                {
                    borrowMaster.PAYTARGET = 1;//2013/12/16号起PAYTARGET字段意思:0原始值,目前不用,1付本人,2付多人
                }
                else
                {
                    borrowMaster.PAYTARGET = 2;
                }
                string strPayInfo = string.Empty;
                if (this.rbSelf.IsChecked.Value)
                {
                    strPayInfo += "汇本人账户";
                }
                else
                {
                    strPayInfo += wtOther.Text;
                }
                borrowMaster.PAYMENTINFO = strPayInfo;
                #endregion
            }
            else
            {
                borrowMaster.PAYTARGET = 0;     //待改,保留原来值
                borrowMaster.PAYMENTINFO = txtPayInfo.Text;
            }
            borrowMaster.REMARK = txtRemark.Text;
            borrowMaster.REPAYTYPE = nBorrowType;
            borrowMaster.TOTALMONEY = decimal.Parse(txttotal.Text.ToString());
            borrowMaster.UPDATEDATE = DateTime.Now;
            borrowMaster.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
            borrowMaster.UPDATEUSERNAME = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
         

            borrowDtlList.Clear();
            foreach (object obj in dgvBorrowDetailList.ItemsSource)
            {
                T_FB_BORROWAPPLYDETAIL ent = obj as T_FB_BORROWAPPLYDETAIL;
                T_FB_BORROWAPPLYDETAIL borrow = new T_FB_BORROWAPPLYDETAIL();
                borrow.BORROWAPPLYDETAILID = System.Guid.NewGuid().ToString();
                borrow.CHARGETYPE = ent.CHARGETYPE;
                borrow.CREATEDATE = DateTime.Now;
                borrow.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
                borrow.T_FB_BORROWAPPLYMASTER = borrowMaster;
                borrow.UPDATEDATE = DateTime.Now;
                borrow.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;

                if (dgvBorrowDetailList.Columns[0].GetCellContent(obj) != null)
                {
                    TextBox txtMark = dgvBorrowDetailList.Columns[0].GetCellContent(obj).FindName("txtRemark") as TextBox;
                    borrow.REMARK = txtMark.Text;
                }
                if (dgvBorrowDetailList.Columns[1].GetCellContent(obj) != null)
                {
                    TextBox tbMon = dgvBorrowDetailList.Columns[1].GetCellContent(obj).FindName("txtMon") as TextBox;
                    borrow.BORROWMONEY = decimal.Parse(string.IsNullOrEmpty(tbMon.Text.ToString()) == true ? "0" : tbMon.Text.ToString());
                    borrow.UNREPAYMONEY = borrow.BORROWMONEY;
                }
                borrowDtlList.Add(borrow);
            }

            RefreshUI(RefreshedTypes.ShowProgressBar);
            try
            {
                string strMsg = string.Empty;
                if (types == FormTypes.New)
                {
                    client.AddBorrowApplyMasterAndDetailAsync(borrowMaster, borrowDtlList);
                }
                else if (types == FormTypes.Edit)
                {
                    if (needsubmit == false)
                    {
                        client.UptBorrowApplyMasterAndDetailAsync("Edit", borrowMaster, borrowDtlList, strMsg, "Edit");
                    }
                    else
                    {
                        BorrowMasterEntity = borrowMaster;
                        client.GetBorrowOrderCodeAsync(borrowMaster);
                    }
                }
                else if (types == FormTypes.Resubmit)
                {
                    client.UptBorrowApplyMasterAndDetailAsync("ReSubmit", borrowMaster, borrowDtlList, strMsg, "ReSubmit");
                }
            }
            catch (Exception ex)
            {
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.ToString());
                return;
            }
        }
Exemple #8
0
 private void SetForms()
 {
     if (types == FormTypes.Audit || types == FormTypes.Browse)
     {
         txtOwnerID.IsReadOnly = true;
         txtRemark.IsReadOnly = true;
         btnLookUpOwner.IsEnabled = false;
         RepayDate.IsEnabled = false;
         txtCode.IsReadOnly = true;
         txtRemark.IsReadOnly = true;
         txtPayInfo.IsReadOnly = true;
         txttotal.IsReadOnly = true;
         rabGeneral.IsEnabled = false;
         rabBackup.IsEnabled = false;
         rabSpecial.IsEnabled = false;
         //AddSub.IsEnabled = false;
         dgvBorrowDetailList.IsReadOnly = true;
         dgvBorrowDetailList.IsEnabled = false;
         this.rbSelf.IsEnabled = false;
         this.rbOther.IsEnabled = false;
         this.wtOther.IsReadOnly = true;
     }
     else if (types == FormTypes.New)
     {
         strOwnerCompanyID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
         strOwnerCompanyName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;
         strOwnerDepartmentID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
         strOwnerDepartmentName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;
         strOwnerPostID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostID;
         strOwnerPostName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.UserPosts[0].PostName;
         strOwnerID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
         strOwnerName = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeName;
         txtOwnerName.Text = strOwnerName + "-" + strOwnerPostName + "-" + strOwnerDepartmentName + "-" + strOwnerCompanyName;
         //新建借款单是默认添加一天明细信息
         T_FB_BORROWAPPLYDETAIL borent = new T_FB_BORROWAPPLYDETAIL();
         borent.BORROWAPPLYDETAILID = System.Guid.NewGuid().ToString();
         borent.CHARGETYPE = 1;
         borent.REMARK = "";
         borent.BORROWMONEY = 0;
         borent.CREATEDATE = DateTime.Now;
         borent.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
         borent.UPDATEDATE = DateTime.Now;
         borent.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
         boDtlobj.Add(borent);
         dgvBorrowDetailList.ItemsSource = boDtlobj;
         if(dgvBorrowDetailList.ItemsSource != null)
         {
             foreach (object obj in dgvBorrowDetailList.ItemsSource)
             {
                 if (dgvBorrowDetailList.Columns[0].GetCellContent(obj) != null)
                 {
                     TextBox tbMark = dgvBorrowDetailList.Columns[0].GetCellContent(obj).FindName("txtRemark") as TextBox;
                     tbMark.Focus();
                 }
             }
         }
         this.wtOther.Visibility = Visibility.Collapsed;
         this.txtPayInfo.Visibility = Visibility.Collapsed;
         hideCode();
         //end
     }
 }
Exemple #9
0
 private void AddSub_Click(object sender, RoutedEventArgs e)
 {
     if(boDtlobj.Count()==5)
     {
         Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("TIPS"), "明细不能超过5条!");
         return;
     }
     T_FB_BORROWAPPLYDETAIL borent = new T_FB_BORROWAPPLYDETAIL();
     borent.BORROWAPPLYDETAILID = System.Guid.NewGuid().ToString();
     borent.CHARGETYPE = 1;
     borent.REMARK = "";
     borent.BORROWMONEY = 0;
     borent.CREATEDATE = DateTime.Now;
     borent.CREATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
     borent.UPDATEDATE = DateTime.Now;
     borent.UPDATEUSERID = SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID;
     boDtlobj.Add(borent);
     dgvBorrowDetailList.ItemsSource = boDtlobj;
 }
Exemple #10
0
 public T_FB_BORROWAPPLYDETAIL GetBorrowApplyDetailByID(string strBorrowApplyDetailId)
 {
     T_FB_BORROWAPPLYDETAIL entRd = new T_FB_BORROWAPPLYDETAIL();
     using(BorrowApplyDetailBLL bllBorrowApplyDetail = new BorrowApplyDetailBLL())
     {
         entRd = bllBorrowApplyDetail.GetBorrowApplyDetailByID(strBorrowApplyDetailId);
         return entRd;
     }
 }