Beispiel #1
0
        private void Save()
        {
            try
            {
                if (action == FormTypes.Browse)            //查看
                {
                    RefreshUI(refreshType);
                }
                else
                {
                    if (Check())
                    {
                        RefreshUI(RefreshedTypes.ShowProgressBar);
                        //fbCtr.Save(GlobalFunction.GetCheckStateByValue(checkstate));
                        organ.ISCHARGE = (bool)FeeChkBox.IsChecked ? "1" : "0";
                        //fbCtr.Order.ORDERID = organ.ORGANIZATIONID;
                        organ.CHARGEMONEY = fbCtr.Order.TOTALMONEY;
                        //organ.CHARGEMONEY
                        //organ.ORGCODE = txtOrganCode.DataContext.ToString();
                        AddLicenseMatserObjList();

                        if (action == FormTypes.New)
                        {
                            organ.CHECKSTATE         = ((int)CheckStates.UnSubmit).ToString();
                            organ.CREATEUSERID       = Common.CurrentLoginUserInfo.EmployeeID;
                            organ.CREATEUSERNAME     = Common.CurrentLoginUserInfo.EmployeeName;
                            organ.CREATEPOSTID       = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                            organ.CREATEDEPARTMENTID = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                            organ.CREATECOMPANYID    = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                            organ.CREATEDATE         = DateTime.Now;
                            organ.OWNERID            = Common.CurrentLoginUserInfo.EmployeeID;
                            organ.OWNERNAME          = Common.CurrentLoginUserInfo.EmployeeName;
                            organ.OWNERPOSTID        = Common.CurrentLoginUserInfo.UserPosts[0].PostID;
                            organ.OWNERDEPARTMENTID  = Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;
                            organ.OWNERCOMPANYID     = Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;
                            organ.ORGANIZATIONID     = Guid.NewGuid().ToString();

                            //fbCtr.Save(SMT.SaaS.FrameworkUI.CheckStates.UnSubmit);
                            //client.AddOrganAsync(organ,licenseMatserObjList);
                        }
                        else
                        {
                            organ.UPDATEUSERID   = Common.CurrentLoginUserInfo.EmployeeID;
                            organ.UPDATEUSERNAME = Common.CurrentLoginUserInfo.EmployeeName;
                            organ.UPDATEDATE     = DateTime.Now;
                            organ.CHECKSTATE     = "0";
                            //client.UpdateOrganAsync(organ, licenseMatserObjList);
                        }
                        if (FBControlIsUsed) //使用了费用控件则提交费用信息 先添加费用信息 后提交
                        {
                            fbCtr.Order.ORDERID = organ.ORGANIZATIONID;
                            fbCtr.Save(SMT.SaaS.FrameworkUI.CheckStates.UnSubmit);//提交费用
                        }
                        else
                        {
                            switch (action)
                            {
                            case FormTypes.New:
                                client.AddOrganAsync(organ, licenseMatserObjList, "Add");
                                break;

                            case FormTypes.Edit:
                                client.UpdateOrganAsync(organ, licenseMatserObjList, "Edit");
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //HtmlPage.Window.Alert(ex.ToString());
                RefreshUI(RefreshedTypes.HideProgressBar);
                Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), ex.Message.ToString());
            }
        }