private void InitUI() { //Get Values from Config Guid systemCountry; Guid systemCurrency; bool debug = false; bool useDatabaseDataDemo = Convert.ToBoolean(GlobalFramework.Settings["useDatabaseDataDemo"]); if (GlobalFramework.Settings["xpoOidConfigurationCountrySystemCountry"] != string.Empty) { systemCountry = new Guid(GlobalFramework.Settings["xpoOidConfigurationCountrySystemCountry"]); } else { systemCountry = SettingsApp.XpoOidConfigurationCountryPortugal; } if (GlobalFramework.Settings["xpoOidConfigurationCurrencySystemCurrency"] != string.Empty) { systemCurrency = new Guid(GlobalFramework.Settings["xpoOidConfigurationCurrencySystemCurrency"]); } else { systemCurrency = SettingsApp.XpoOidConfigurationCurrencyEuro; } //Init Inital Values CFG_ConfigurationCountry intialValueConfigurationCountry = (CFG_ConfigurationCountry)FrameworkUtils.GetXPGuidObject(typeof(CFG_ConfigurationCountry), systemCountry); CFG_ConfigurationCurrency intialValueConfigurationCurrency = (CFG_ConfigurationCurrency)FrameworkUtils.GetXPGuidObject(typeof(CFG_ConfigurationCurrency), systemCurrency); try { //Init dictionary for Parameters + Widgets _dictionaryObjectBag = new Dictionary <CFG_ConfigurationPreferenceParameter, EntryBoxValidation>(); //Pack VBOX VBox vbox = new VBox(true, 2) { WidthRequest = 300 }; //Country CriteriaOperator criteriaOperatorSystemCountry = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1) AND (RegExFiscalNumber IS NOT NULL)"); _entryBoxSelectSystemCountry = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCountry, TreeViewConfigurationCountry>(this, Resx.global_country, "Designation", "Oid", intialValueConfigurationCountry, criteriaOperatorSystemCountry, SettingsApp.RegexGuid, true); _entryBoxSelectSystemCountry.EntryValidation.IsEditable = false; _entryBoxSelectSystemCountry.EntryValidation.Validate(_entryBoxSelectSystemCountry.Value.Oid.ToString()); //Disabled, Now Country and Currency are disabled _entryBoxSelectSystemCountry.ButtonSelectValue.Sensitive = true; _entryBoxSelectSystemCountry.EntryValidation.Sensitive = true; _entryBoxSelectSystemCountry.ClosePopup += delegate { ////Require to Update RegEx _entryBoxZipCode.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExZipCode; _entryBoxZipCode.EntryValidation.Validate(); //Require to Update RegEx and Criteria to filter Country Clients Only _entryBoxFiscalNumber.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExFiscalNumber; _entryBoxFiscalNumber.EntryValidation.Validate(); if (_entryBoxFiscalNumber.EntryValidation.Validated) { bool isValidFiscalNumber = FiscalNumber.IsValidFiscalNumber(_entryBoxFiscalNumber.EntryValidation.Text, _entryBoxSelectSystemCountry.Value.Code2); _entryBoxFiscalNumber.EntryValidation.Validated = isValidFiscalNumber; } //Call Main Validate Validate(); }; //Currency CriteriaOperator criteriaOperatorSystemCurrency = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled <> 1)"); _entryBoxSelectSystemCurrency = new XPOEntryBoxSelectRecordValidation <CFG_ConfigurationCurrency, TreeViewConfigurationCurrency>(this, Resx.global_currency, "Designation", "Oid", intialValueConfigurationCurrency, criteriaOperatorSystemCurrency, SettingsApp.RegexGuid, true); _entryBoxSelectSystemCurrency.EntryValidation.IsEditable = false; _entryBoxSelectSystemCurrency.EntryValidation.Validate(_entryBoxSelectSystemCurrency.Value.Oid.ToString()); //Disabled, Now Country and Currency are disabled //_entryBoxSelectSystemCurrency.ButtonSelectValue.Sensitive = false; //_entryBoxSelectSystemCurrency.EntryValidation.Sensitive = false; _entryBoxSelectSystemCurrency.ClosePopup += delegate { //Call Main Validate Validate(); }; //Add to Vbox vbox.PackStart(_entryBoxSelectSystemCountry, true, true, 0); vbox.PackStart(_entryBoxSelectSystemCurrency, true, true, 0); //Start Render Dynamic Inputs CriteriaOperator criteriaOperator = CriteriaOperator.Parse("(Disabled = 0 OR Disabled is NULL) AND (FormType = 1 AND FormPageNo = 1)"); SortProperty[] sortProperty = new SortProperty[2]; sortProperty[0] = new SortProperty("Ord", SortingDirection.Ascending); XPCollection xpCollection = new XPCollection(GlobalFramework.SessionXpo, typeof(CFG_ConfigurationPreferenceParameter), criteriaOperator, sortProperty); if (xpCollection.Count > 0) { string label = string.Empty; string regEx = string.Empty; object regExObj = null; bool required = false; foreach (CFG_ConfigurationPreferenceParameter item in xpCollection) { label = (item.ResourceString != null && Resx.ResourceManager.GetString(item.ResourceString) != null) ? Resx.ResourceManager.GetString(item.ResourceString) : string.Empty; regExObj = FrameworkUtils.GetFieldValueFromType(typeof(SettingsApp), item.RegEx); regEx = (regExObj != null) ? regExObj.ToString() : string.Empty; required = Convert.ToBoolean(item.Required); //Override Db Regex if (item.Token == "COMPANY_POSTALCODE") { regEx = _entryBoxSelectSystemCountry.Value.RegExZipCode; } if (item.Token == "COMPANY_FISCALNUMBER") { regEx = _entryBoxSelectSystemCountry.Value.RegExFiscalNumber; } //Debug //_log.Debug(string.Format("Label: [{0}], RegEx: [{1}], Required: [{2}]", label, regEx, required)); EntryBoxValidation entryBoxValidation = new EntryBoxValidation( this, label, KeyboardMode.AlfaNumeric, regEx, required ) { Name = item.Token }; //Only Assign Value if Debugger Attached : Now the value for normal user is cleaned in Init Database, we keep this code here, may be usefull if (Debugger.IsAttached == true || useDatabaseDataDemo) { entryBoxValidation.EntryValidation.Text = item.Value; } if (Debugger.IsAttached == true) { if (debug) { _log.Debug(String.Format("[{0}:{1}]:item.Value: [{2}], entryBoxValidation.EntryValidation.Text: [{3}]", Debugger.IsAttached == true, useDatabaseDataDemo, item.Value, entryBoxValidation.EntryValidation.Text)); } } //Assign shared Event entryBoxValidation.EntryValidation.Changed += EntryValidation_Changed; //If is ZipCode Assign it to _entryBoxZipCode Reference if (item.Token == "COMPANY_POSTALCODE") { _entryBoxZipCode = entryBoxValidation; _entryBoxZipCode.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExZipCode; } //If is FiscalNumber Assign it to entryBoxSelectCustomerFiscalNumber Reference else if (item.Token == "COMPANY_FISCALNUMBER") { _entryBoxFiscalNumber = entryBoxValidation; _entryBoxFiscalNumber.EntryValidation.Rule = _entryBoxSelectSystemCountry.Value.RegExFiscalNumber; } if (item.Token == "COMPANY_TAX_ENTITY") { entryBoxValidation.EntryValidation.Text = "Global"; } //Call Validate entryBoxValidation.EntryValidation.Validate(); //Pack and Add to ObjectBag vbox.PackStart(entryBoxValidation, true, true, 0); _dictionaryObjectBag.Add(item, entryBoxValidation); } } Viewport viewport = new Viewport() { ShadowType = ShadowType.None }; viewport.Add(vbox); _scrolledWindow = new ScrolledWindow(); _scrolledWindow.ShadowType = ShadowType.EtchedIn; _scrolledWindow.SetPolicy(PolicyType.Automatic, PolicyType.Automatic); _scrolledWindow.Add(viewport); viewport.ResizeMode = ResizeMode.Parent; _scrolledWindow.ResizeMode = ResizeMode.Parent; } catch (Exception ex) { _log.Error(ex.Message, ex); } }
public void load_data() { WebModule.Accounting.Report.S04b5_DN s04b5_dn = new Report.S04b5_DN(); #region tham số truyền int month = Int32.Parse(this.hS04b5DN_month.Get("month_id").ToString()); int year = Int32.Parse(this.hS04b5DN_year.Get("year_id").ToString()); string owner = "QUASAPHARCO"; //string asset = ""; #endregion s04b5_dn.xrMonth.Text = month.ToString(); s04b5_dn.xrYear.Text = year.ToString(); #region object MonthDim md = session.FindObject <MonthDim>(CriteriaOperator.Parse(String.Format("Name='{0}'", month))); YearDim yd = session.FindObject <YearDim>(CriteriaOperator.Parse(String.Format("Name='{0}'", year))); OwnerOrgDim ood = session.FindObject <OwnerOrgDim>(CriteriaOperator.Parse(String.Format("Code='{0}'", owner))); int CorrespondFinancialAccountDimId_default = CorrespondFinancialAccountDim.GetDefault(session, CorrespondFinancialAccountDimEnum.NAAN_DEFAULT).CorrespondFinancialAccountDimId; FinancialSalesOrManufactureExpenseSummary_Fact FinancialFact_General = null; #endregion #region header và table báo cáo grid_header(); DataTable datatable = table_pri(); #endregion #region all row List <string> all_row_f_c = new List <string>(); if (md != null && yd != null && ood != null) { // chung FinancialFact_General = session.FindObject <FinancialSalesOrManufactureExpenseSummary_Fact>( CriteriaOperator.Parse(String.Format("MonthDimId='{0}' AND YearDimId='{1}' AND " + "OwnerOrgDimId='{2}' AND RowStatus='1'", md.MonthDimId, yd.YearDimId, ood.OwnerOrgDimId))); // f & c all_row_f_c.AddRange(support_find_row_TK(FinancialFact_General, "241")); all_row_f_c.AddRange(support_find_row_TK(FinancialFact_General, "641")); all_row_f_c.AddRange(support_find_row_TK(FinancialFact_General, "642")); // } #endregion #region đổ dữ liệu int STTu = 1; // từng dòng foreach (string each_row in all_row_f_c) { #region FinancialAccountDim fFinancialAccountDim = session.FindObject <FinancialAccountDim>( CriteriaOperator.Parse(String.Format("Code='{0}'", each_row.Substring(0, 3)))); // column stt DataRow dr = datatable.NewRow(); if (each_row == "241" || each_row == "641" || each_row == "642") { dr["stt"] = STTu++; } // column tk_no FinancialAccountDim get_Description = session.FindObject <FinancialAccountDim>( CriteriaOperator.Parse(String.Format("Code='{0}'", each_row))); if (each_row == "241" || each_row == "641" || each_row == "642") { dr["tk_no"] = String.Format("TK {0} - {1}", each_row, get_Description.Description); } else { dr["tk_no"] = get_Description.Description; } #endregion double sum_CPTT = 0; // từng cột foreach (string each_column in list_header()) { #region int TK_column_CorrespondFinancialAccountDimId = session.FindObject <CorrespondFinancialAccountDim>( CriteriaOperator.Parse(String.Format("Code='{0}'", each_column))).CorrespondFinancialAccountDimId; //// if (md != null && yd != null && ood != null) { // only FinancialFact_General = session.FindObject <FinancialSalesOrManufactureExpenseSummary_Fact>( CriteriaOperator.Parse(String.Format("MonthDimId='{0}' AND YearDimId='{1}' AND " + "OwnerOrgDimId='{2}' AND RowStatus='1'", md.MonthDimId, yd.YearDimId, ood.OwnerOrgDimId))); if (FinancialFact_General != null && fFinancialAccountDim != null) { SalesOrManufactureExpenseByGroup SalesByGroup = session.FindObject < SalesOrManufactureExpenseByGroup>(CriteriaOperator.Parse( String.Format("FinancialSalesOrManufactureExpenseSummary_FactId='{0}' AND " + "FinancialAccountDimId='{1}' AND RowStatus='1'", FinancialFact_General.FinancialSalesOrManufactureExpenseSummary_FactId, fFinancialAccountDim.FinancialAccountDimId ))); if (SalesByGroup != null) { //tìm tập hợp của tài khoản cha & con với từng tk header XPCollection <FinancialSalesOrManufactureExpenseDetail> all_detail = new XPCollection <FinancialSalesOrManufactureExpenseDetail>(session, CriteriaOperator.Parse(String.Format("SalesOrManufactureExpenseByGroupId='{0}' AND " + "CorrespondFinancialAccountDimId='{1}' AND " + "Credit>0 AND " + "RowStatus='1'", SalesByGroup.SalesOrManufactureExpenseByGroupId, TK_column_CorrespondFinancialAccountDimId ))); if (all_detail.Count != 0) { if (each_row == "241" || each_row == "641" || each_row == "642") { double sum_fFinancialAccountDim = 0; foreach (FinancialSalesOrManufactureExpenseDetail each_detail in all_detail) { // tổng sum_fFinancialAccountDim += (double)each_detail.Credit; //chi phí thực tế sum_CPTT += (double)each_detail.Credit; } dr[each_column] = sum_fFinancialAccountDim; } else { double cell = 0; foreach (FinancialSalesOrManufactureExpenseDetail each_detail in all_detail) { if (each_row == each_detail.FinancialAccountDimId.Code) { cell += (double)each_detail.Credit; //chi phí thực tế sum_CPTT += (double)each_detail.Credit; } } dr[each_column] = cell; } } if (each_row == "241" || each_row == "641" || each_row == "642") { dr["cong_tt"] = SalesByGroup.SumExpense; } else { dr["cong_tt"] = sum_CPTT; } } } } //// #endregion } datatable.Rows.Add(dr); } #endregion #region dòng cộng DataRow dr_c = datatable.NewRow(); dr_c["tk_no"] = "CỘNG"; List <string> all_column = list_header(); all_column.Add("cong_tt"); foreach (string each_column in all_column) { double sum = 0; try { sum += (from DataRow dr1 in datatable.Rows where dr1["stt"].Equals("1") select(double) dr1[each_column]).FirstOrDefault(); } catch { } try { sum += (from DataRow dr1 in datatable.Rows where dr1["stt"].Equals("2") select(double) dr1[each_column]).FirstOrDefault(); } catch { } try { sum += (from DataRow dr1 in datatable.Rows where dr1["stt"].Equals("3") select(double) dr1[each_column]).FirstOrDefault(); } catch { } dr_c[each_column] = sum; } datatable.Rows.Add(dr_c); #endregion #region out gridview GridView_S04b5DN.DataSource = datatable; GridView_S04b5DN.DataBind(); #endregion #region export report s04b5_dn.printableCC_S04b5DN.PrintableComponent = new PrintableComponentLinkBase() { Component = GridViewExporter_S04b5DN }; ReportViewer_S04b5DN.Report = s04b5_dn; #endregion }
public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); UpdateAnalysisCriteriaColumn(); SecuritySystemRole defaultRole = CreateDefaultRole(); Position developerPosition = ObjectSpace.FindObject <Position>(CriteriaOperator.Parse("Title == 'Developer'")); if (developerPosition == null) { developerPosition = ObjectSpace.CreateObject <Position>(); developerPosition.Title = "Developer"; } Position managerPosition = ObjectSpace.FindObject <Position>(CriteriaOperator.Parse("Title == 'Manager'")); if (managerPosition == null) { managerPosition = ObjectSpace.CreateObject <Position>(); managerPosition.Title = "Manager"; } Department devDepartment = ObjectSpace.FindObject <Department>(CriteriaOperator.Parse("Title == 'Development Department'")); if (devDepartment == null) { devDepartment = ObjectSpace.CreateObject <Department>(); devDepartment.Title = "Development Department"; devDepartment.Office = "205"; devDepartment.Positions.Add(developerPosition); devDepartment.Positions.Add(managerPosition); } Contact contactMary = ObjectSpace.FindObject <Contact>(CriteriaOperator.Parse("FirstName == 'Mary' && LastName == 'Tellitson'")); if (contactMary == null) { contactMary = ObjectSpace.CreateObject <Contact>(); contactMary.FirstName = "Mary"; contactMary.LastName = "Tellitson"; contactMary.Email = "*****@*****.**"; contactMary.Birthday = new DateTime(1980, 11, 27); contactMary.Department = devDepartment; contactMary.Position = managerPosition; } Contact contactJohn = ObjectSpace.FindObject <Contact>(CriteriaOperator.Parse("FirstName == 'John' && LastName == 'Nilsen'")); if (contactJohn == null) { contactJohn = ObjectSpace.CreateObject <Contact>(); contactJohn.FirstName = "John"; contactJohn.LastName = "Nilsen"; contactJohn.Email = "*****@*****.**"; contactJohn.Birthday = new DateTime(1981, 10, 3); contactJohn.Department = devDepartment; contactJohn.Position = developerPosition; } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Review reports'")) == null) { DemoTask task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Review reports"; task.AssignedTo = contactJohn; task.StartDate = DateTime.Parse("May 03, 2008"); task.DueDate = DateTime.Parse("September 06, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.InProgress; task.Priority = Priority.High; task.EstimatedWork = 60; task.Description = "Analyse the reports and assign new tasks to employees."; } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Fix breakfast'")) == null) { DemoTask task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Fix breakfast"; task.AssignedTo = contactMary; task.StartDate = DateTime.Parse("May 03, 2008"); task.DueDate = DateTime.Parse("May 04, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.Completed; task.Priority = Priority.Low; task.EstimatedWork = 1; task.ActualWork = 3; task.Description = "The Development Department - by 9 a.m.\r\nThe R&QA Department - by 10 a.m."; } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Task1'")) == null) { DemoTask task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Task1"; task.AssignedTo = contactJohn; task.StartDate = DateTime.Parse("June 03, 2008"); task.DueDate = DateTime.Parse("June 06, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.Completed; task.Priority = Priority.High; task.EstimatedWork = 10; task.ActualWork = 15; task.Description = "A task designed specially to demonstrate the PivotChart module. Switch to the Reports navigation group to view the generated analysis."; } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Task2'")) == null) { DemoTask task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Task2"; task.AssignedTo = contactJohn; task.StartDate = DateTime.Parse("July 03, 2008"); task.DueDate = DateTime.Parse("July 06, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.Completed; task.Priority = Priority.Low; task.EstimatedWork = 8; task.ActualWork = 16; task.Description = "A task designed specially to demonstrate the PivotChart module. Switch to the Reports navigation group to view the generated analysis."; } UpdateStatus("CreateAnalysis", "", "Creating analysis reports in the database..."); CreateDataToBeAnalysed(); UpdateStatus("CreateSecurityData", "", "Creating users and roles in the database..."); #region Create a User for the Simple Security Strategy //// If a simple user named 'Sam' doesn't exist in the database, create this simple user //SecuritySimpleUser adminUser = ObjectSpace.FindObject<SecuritySimpleUser>(new BinaryOperator("UserName", "Sam")); //if(adminUser == null) { // adminUser = ObjectSpace.CreateObject<SecuritySimpleUser>(); // adminUser.UserName = "******"; //} //// Make the user an administrator //adminUser.IsAdministrator = true; //// Set a password if the standard authentication type is used //adminUser.SetPassword(""); #endregion #region Create Users for the Complex Security Strategy // If a user named 'Sam' doesn't exist in the database, create this user SecuritySystemUser user1 = ObjectSpace.FindObject <SecuritySystemUser>(new BinaryOperator("UserName", "Sam")); if (user1 == null) { user1 = ObjectSpace.CreateObject <SecuritySystemUser>(); user1.UserName = "******"; // Set a password if the standard authentication type is used user1.SetPassword(""); } // If a user named 'John' doesn't exist in the database, create this user SecuritySystemUser user2 = ObjectSpace.FindObject <SecuritySystemUser>(new BinaryOperator("UserName", "John")); if (user2 == null) { user2 = ObjectSpace.CreateObject <SecuritySystemUser>(); user2.UserName = "******"; // Set a password if the standard authentication type is used user2.SetPassword(""); } // If a role with the Administrators name doesn't exist in the database, create this role SecuritySystemRole adminRole = ObjectSpace.FindObject <SecuritySystemRole>(new BinaryOperator("Name", "Administrators")); if (adminRole == null) { adminRole = ObjectSpace.CreateObject <SecuritySystemRole>(); adminRole.Name = "Administrators"; } adminRole.IsAdministrative = true; // If a role with the Users name doesn't exist in the database, create this role SecuritySystemRole userRole = ObjectSpace.FindObject <SecuritySystemRole>(new BinaryOperator("Name", "Users")); if (userRole == null) { userRole = ObjectSpace.CreateObject <SecuritySystemRole>(); userRole.Name = "Users"; } userRole.SetTypePermissionsRecursively <object>(SecurityOperations.FullAccess, SecuritySystemModifier.Allow); userRole.SetTypePermissionsRecursively <SecuritySystemUser>(SecurityOperations.FullAccess, SecuritySystemModifier.Deny); userRole.SetTypePermissionsRecursively <SecuritySystemRole>(SecurityOperations.FullAccess, SecuritySystemModifier.Deny); // Add the Administrators role to the user1 user1.Roles.Add(adminRole); // Add the Users role to the user2 user2.Roles.Add(userRole); user2.Roles.Add(defaultRole); #endregion ObjectSpace.CommitChanges(); }
public ActionResult Get(string bokey) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get(" + bokey + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); vwBusinessPartners existing = objectSpace.FindObject <vwBusinessPartners>(CriteriaOperator.Parse("BoKey=?", bokey)); if (existing == null) { NotFound(); } return(Ok(existing)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-Get(" + bokey + "):[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public static List <WorkflowStep> GetCurrentRecordOption(Line _line) { List <WorkflowStep> lst = new List <WorkflowStep>(); MyEnums.WorkflowTarget target; if (_line is Account) { target = MyEnums.WorkflowTarget.Account; } else if (_line is DocumentBase) { target = MyEnums.WorkflowTarget.Document; } else { throw new Exception("Current line does not hav workflow status info we could not apply workflow step on it"); } string filer = "[WorkflowTarget] = ? AND [CurrentWorkflow] = ? "; XPCollection nextSteps = new XPCollection(_line.Session, typeof(WorkflowStep), CriteriaOperator.Parse(filer, target, _line.WorkflowStatus)); foreach (WorkflowStep item in nextSteps) { lst.Add(item); } return(lst); }
public void ChangeArtistByDetail_CheckUpdateInArtistsList() { ModulesManager.Current.OpenModuleObjectDetail(new ArtistsListObject(Session), false); ArtistsListView artistsListView = ArtistsListView.LastCreatedView; artistsListView.Module.OpenDetail(JamesCameron.Oid); ArtistDetailView detail = ArtistDetailView.LastCreatedView; Artist jamesCameron = new XPCollection <Artist>(artistsListView.Module.ArtistsEdit.VRObjectsEditObject.VideoRentObjects, CriteriaOperator.Parse("Oid = ?", JamesCameron.Oid))[0]; detail.Module.ArtistEdit.VRObjectEditObject.VideoRentObject.Biography += "_Updated"; string updatedBiography = detail.Module.ArtistEdit.VRObjectEditObject.VideoRentObject.Biography; detail.Module.SaveAndDispose(); Assert.AreEqual(updatedBiography, jamesCameron.Biography); artistsListView.Module.Dispose(); }
public void ChangeCategoryName_EditMovie_CheckCategoryName_AddMovieCategoryWithExistingName() { string categoryName = new XPCollection <MovieCategory>(Session)[0].Name; Guid categoryOid = new MovieCategory(Session).Oid; SessionHelper.CommitSession(Session, null); using (MovieCategoriesList categorieslist = (MovieCategoriesList)ModulesManager.Current.OpenModuleObjectDetail(new MovieCategoriesListObject(Session), false)) { categorieslist.MovieCategoriesEdit.CurrentRecord = SessionHelper.GetObjectByKey <MovieCategory>(categoryOid, categorieslist.MovieCategoriesEdit.VRObjectsEditObject.VideoRentObjects.Session); Assert.AreEqual(categorieslist.MovieCategoriesEdit.CurrentRecord, categorieslist.MovieCategoryEdit.MovieCategoryEditObject.VideoRentObject); categorieslist.MovieCategoriesEdit.CurrentRecord.Name = "new name"; Assert.IsTrue(categorieslist.DirtyRough); using (MovieDetail movieDetail = (MovieDetail)ModulesManager.Current.OpenModuleObjectDetail(new MovieDetailObject(Session, Avatar.Oid), true)) { XPCollection <MovieCategory> categories = new XPCollection <MovieCategory>(movieDetail.MovieEdit.MovieCategoryEditData.List, CriteriaOperator.Parse("Name = ?", "new name")); Assert.AreEqual(1, categories.Count); } } using (MovieDetail movieDetail = (MovieDetail)ModulesManager.Current.OpenModuleObjectDetail(new MovieDetailObject(Session, Avatar.Oid), true)) { using (MovieCategoryDetail movieCategoryDetail = movieDetail.MovieEdit.OpenNewCategoryDialog()) { movieCategoryDetail.MovieCategoryEdit.MovieCategoryEditObject.VideoRentObject.Name = categoryName; movieCategoryDetail.SaveAndDispose(); } } }
public static options GetOptionValue(Session session, string optionName) { return(session.FindObject <options>(CriteriaOperator.Parse("acc_option_name = ?", optionName))); //return session.FindObject<options>(CriteriaOperator.Parse("account_id = ?", Types.OptionsType.FilesPath.ToString())); }
public static options GetOptionalue(DevExpress.ExpressApp.IObjectSpace objectSpace, string optionName) { return(objectSpace.FindObject <options>(CriteriaOperator.Parse("option_name = ?", optionName))); //return objectSpace.FindObject<options>(CriteriaOperator.Parse("option_value = ?", Types.OptionsType.FilesPath.ToString())); }
private static DetailView CreateDetailView(DetailView detailView, object o, ListView listView, DashboardViewItem dashboardViewItem, Frame frame) { var objectTypeLink = ((IModelApplicationMasterDetail)detailView.Model.Application).DashboardMasterDetail .ObjectTypeLinks .FirstOrDefault(link => { if (link.ModelClass.TypeInfo.Type == o.GetType()) { var fitForCriteria = listView.ObjectSpace.IsObjectFitForCriteria(o, CriteriaOperator.Parse(link.Criteria)); return(!fitForCriteria.HasValue || fitForCriteria.Value); } return(false); }); if (objectTypeLink != null) { detailView.Close(); dashboardViewItem.Frame.SetView(null); var application = dashboardViewItem.Frame.Application; var objectSpace = application.CreateObjectSpace(); detailView = application.CreateDetailView(objectSpace, objectTypeLink.DetailView.Id, true, dashboardViewItem.InnerView); dashboardViewItem.Frame.SetView(detailView, true, frame); } detailView.CurrentObject = detailView.ObjectSpace.GetObject(o); return(detailView); }
public override void UpdateDatabaseAfterUpdateSchema() { base.UpdateDatabaseAfterUpdateSchema(); #if EASYTEST var developerPosition = ObjectSpace.FindObject <Position>(CriteriaOperator.Parse("Title == 'Developer'")); if (developerPosition == null) { developerPosition = ObjectSpace.CreateObject <Position>(); developerPosition.Title = "Developer"; developerPosition.Save(); } var managerPosition = ObjectSpace.FindObject <Position>(CriteriaOperator.Parse("Title == 'Manager'")); if (managerPosition == null) { managerPosition = ObjectSpace.CreateObject <Position>(); managerPosition.Title = "Manager"; managerPosition.Save(); } var devDepartment = ObjectSpace.FindObject <Department>(CriteriaOperator.Parse("Title == 'Development Department'")); if (devDepartment == null) { devDepartment = ObjectSpace.CreateObject <Department>(); devDepartment.Title = "Development Department"; devDepartment.Office = "205"; devDepartment.Positions.Add(developerPosition); devDepartment.Positions.Add(managerPosition); devDepartment.Save(); } var contactMary = ObjectSpace.FindObject <Contact>(CriteriaOperator.Parse("FirstName == 'Mary' && LastName == 'Tellitson'")); if (contactMary == null) { contactMary = ObjectSpace.CreateObject <Contact>(); contactMary.FirstName = "Mary"; contactMary.LastName = "Tellitson"; contactMary.Email = "*****@*****.**"; contactMary.Birthday = new DateTime(1980, 11, 27); contactMary.Department = devDepartment; contactMary.Position = managerPosition; contactMary.Save(); } var contactJohn = ObjectSpace.FindObject <Contact>(CriteriaOperator.Parse("FirstName == 'John' && LastName == 'Nilsen'")); if (contactJohn == null) { contactJohn = ObjectSpace.CreateObject <Contact>(); contactJohn.FirstName = "John"; contactJohn.LastName = "Nilsen"; contactJohn.Email = "*****@*****.**"; contactJohn.Birthday = new DateTime(1981, 10, 3); contactJohn.Department = devDepartment; contactJohn.Position = developerPosition; contactJohn.Save(); } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Review reports'")) == null) { var task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Review reports"; task.AssignedTo = contactJohn; task.StartDate = DateTime.Parse("May 03, 2008"); task.DueDate = DateTime.Parse("September 06, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.InProgress; task.Priority = Priority.High; task.EstimatedWork = 60; task.Description = "Analyse the reports and assign new tasks to employees."; task.Save(); } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Fix breakfast'")) == null) { var task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Fix breakfast"; task.AssignedTo = contactMary; task.StartDate = DateTime.Parse("May 03, 2008"); task.DueDate = DateTime.Parse("May 04, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.Completed; task.Priority = Priority.Low; task.EstimatedWork = 1; task.ActualWork = 3; task.Description = "The Development Department - by 9 a.m.\r\nThe R&QA Department - by 10 a.m."; task.Save(); } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Task1'")) == null) { var task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Task1"; task.AssignedTo = contactJohn; task.StartDate = DateTime.Parse("June 03, 2008"); task.DueDate = DateTime.Parse("June 06, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.Completed; task.Priority = Priority.High; task.EstimatedWork = 10; task.ActualWork = 15; task.Description = "A task designed specially to demonstrate the PivotChart module. Switch to the Reports navigation group to view the generated analysis."; task.Save(); } if (ObjectSpace.FindObject <DemoTask>(CriteriaOperator.Parse("Subject == 'Task2'")) == null) { var task = ObjectSpace.CreateObject <DemoTask>(); task.Subject = "Task2"; task.AssignedTo = contactJohn; task.StartDate = DateTime.Parse("July 03, 2008"); task.DueDate = DateTime.Parse("July 06, 2008"); task.Status = DevExpress.Persistent.Base.General.TaskStatus.Completed; task.Priority = Priority.Low; task.EstimatedWork = 8; task.ActualWork = 16; task.Description = "A task designed specially to demonstrate the PivotChart module. Switch to the Reports navigation group to view the generated analysis."; task.Save(); } ObjectSpace.CommitChanges(); #endif }
public void GetCaseInfo() { EnumsAll.CaseType caseType = EnumsAll.CaseType.Internal; var sOurNo = CommonFunction.GetOurNo(_sOurNo, ref caseType); if (string.IsNullOrEmpty(sOurNo)) { return; } s_OurNo = sOurNo; switch (caseType) { case EnumsAll.CaseType.Internal: { var dr = DbHelperOra.Query( $"select RECEIVED,CLIENT,CLIENT_NAME,APPL_CODE1,APPLICANT1,APPLICANT_CH1,APPL_CODE2,APPLICANT2,APPLICANT_CH2,APPL_CODE3,APPLICANT3,APPLICANT_CH3,APPL_CODE4,APPLICANT4,APPLICANT_CH4,APPL_CODE5,APPLICANT5,APPLICANT_CH5 from PATENTCASE where OURNO = '{_sOurNo}'").Tables[0].Rows[0]; if (!string.IsNullOrWhiteSpace(dr["RECEIVED"].ToString())) { dt_ReceiveDate = Convert.ToDateTime(dr["RECEIVED"].ToString()); } if (!string.IsNullOrWhiteSpace(dr["CLIENT"].ToString())) { Client = Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{dr["CLIENT"]}'")) ?? new Corporation(Session) { Code = dr["CLIENT"].ToString(), Name = dr["CLIENT_NAME"].ToString() } } ; Applicants.ToList().ForEach(a => Applicants.Remove(a)); for (int i = 1; i <= 5; i++) { if (!string.IsNullOrWhiteSpace(dr[$"APPL_CODE{i}"].ToString())) { Applicants.Add( Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{dr[$"APPL_CODE{i}"]}'")) ?? new Corporation(Session) { Code = dr[$"APPL_CODE{i}"].ToString(), Name = string.IsNullOrWhiteSpace(dr[$"APPLICANT{i}"].ToString()) ? dr[$"APPLICANT_CH{i}"].ToString() : dr[$"APPLICANT{i}"].ToString() }); } } break; } case EnumsAll.CaseType.Foreign: { var dr = DbHelperOra.Query( $"select RECEIVED from FCASE where OURNO = '{_sOurNo}'") .Tables[0].Rows[0]; if (!string.IsNullOrWhiteSpace(dr["RECEIVED"].ToString())) { dt_ReceiveDate = Convert.ToDateTime(dr["RECEIVED"].ToString()); } var dt = DbHelperOra.Query($"select EID,ROLE,ORIG_NAME,TRAN_NAME,ENT_ORDER from FCASE_ENT_REL where OURNO = '{_sOurNo}'").Tables[0]; var tempclient = dt.Select("ROLE = 'CLI' OR ROLE = 'APPCLI'"); if (tempclient.Length > 0) { Client = Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{tempclient[0]["EID"]}'")) ?? new Corporation(Session) { Code = tempclient[0]["EID"].ToString(), Name = !string.IsNullOrWhiteSpace(tempclient[0]["ORIG_NAME"].ToString()) ? tempclient[0]["ORIG_NAME"].ToString() : tempclient[0]["TRAN_NAME"].ToString() } } ; var tempagency = dt.Select("ROLE = 'AGT'"); if (tempagency.Length > 0) { Agency = Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{tempagency[0]["EID"]}'")) ?? new Corporation(Session) { Code = tempagency[0]["EID"].ToString(), Name = !string.IsNullOrWhiteSpace(tempagency[0]["ORIG_NAME"].ToString()) ? tempagency[0]["ORIG_NAME"].ToString() : tempagency[0]["TRAN_NAME"].ToString() } } ; Applicants.ToList().ForEach(a => Applicants.Remove(a)); foreach (var dataRow in dt.Select("ROLE = 'APP' OR ROLE = 'APPCLI'", "ENT_ORDER ASC")) { Applicants.Add( Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{dataRow["EID"]}'")) ?? new Corporation(Session) { Code = dataRow["EID"].ToString(), Name = !string.IsNullOrWhiteSpace(dataRow["ORIG_NAME"].ToString()) ? dataRow["ORIG_NAME"].ToString() : dataRow["TRAN_NAME"].ToString() }); } break; } case EnumsAll.CaseType.Hongkong: { var dr = DbHelperOra.Query($"select cn_app_ref,RECEIVED from ex_hkcase where hk_app_ref = '{_sOurNo}'").Tables[0].Rows[0]; if (!string.IsNullOrWhiteSpace(dr["RECEIVED"]?.ToString())) { dt_ReceiveDate = Convert.ToDateTime(dr["RECEIVED"].ToString()); } if (!string.IsNullOrWhiteSpace(dr["cn_app_ref"]?.ToString())) { var drCN = DbHelperOra.Query( $"select RECEIVED,CLIENT,CLIENT_NAME,APPL_CODE1,APPLICANT1,APPLICANT_CH1,APPL_CODE2,APPLICANT2,APPLICANT_CH2,APPL_CODE3,APPLICANT3,APPLICANT_CH3,APPL_CODE4,APPLICANT4,APPLICANT_CH4,APPL_CODE5,APPLICANT5,APPLICANT_CH5 from PATENTCASE where OURNO = '{dr["cn_app_ref"]?.ToString()}'").Tables[0].Rows[0]; if (!string.IsNullOrWhiteSpace(drCN["CLIENT"].ToString())) { Client = Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{drCN["CLIENT"]}'")) ?? new Corporation(Session) { Code = drCN["CLIENT"].ToString(), Name = drCN["CLIENT_NAME"].ToString() } } ; Applicants.ToList().ForEach(a => Applicants.Remove(a)); for (int i = 1; i <= 5; i++) { if (!string.IsNullOrWhiteSpace(drCN[$"APPL_CODE{i}"].ToString())) { Applicants.Add( Session.FindObject <Corporation>(CriteriaOperator.Parse($"Code = '{drCN[$"APPL_CODE{i}"]}'")) ?? new Corporation(Session) { Code = drCN[$"APPL_CODE{i}"].ToString(), Name = string.IsNullOrWhiteSpace(drCN[$"APPLICANT{i}"].ToString()) ? drCN[$"APPLICANT_CH{i}"].ToString() : drCN[$"APPLICANT{i}"].ToString() }); } } } break; } } Save(); } }
/// <summary> /// vraci seznam kladných nenulových předpisů dle poplatku a osoby_id /// částka predpisu je částka snížená o přípárování zápornou částí (CASTKA = PREDPIS + SANKCE - SPAROVANO_MINUSEM /// => seznam neobsahuje předpisy, které byly celé uhrazeny jen zápornymi předpisy /// </summary> /// <param name="session"></param> /// <param name="EXT_APP_KOD"></param> /// <param name="predpis"></param> /// <returns></returns> internal PREDPISY_RESP DejPredpisy(Session session, int EXT_APP_KOD, int osobaId, int poplKod) { Session sesna = session; PREDPISY_RESP resp = new PREDPISY_RESP(); resp.status = Status.NOTEXISTS; CriteriaOperator criteria; sesna.DropIdentityMap(); #region kontrola vstupnich udaju try { if (EXT_APP_KOD == null) { throw new Exception("kód externí aplikace není zadán"); } KONTROLA_POPLATKU kp = new KONTROLA_POPLATKU(sesna, EXT_APP_KOD); if (!kp.EAexist()) { throw new Exception("Chybný kód externí aplikace."); } if (!kp.existPravoNadPoplatkem(poplKod)) { throw new Exception("K pohledávce neexistuje oprávnění."); } if (osobaId <= 0) { throw new Exception("Osoba musí být zadána."); } #region kontrola prava na cteni predpisu PravoNadPoplatkem pnp = null; try { pnp = new PravoNadPoplatkem(sesna); } catch (Exception) { throw new Exception("kontrola přístp. práv uživatele nad daty Příjmové agendy skončila chybou"); } if (!pnp.PravoExist(poplKod, PravoNadPoplatkem.PrtabTable.PRPL, PravoNadPoplatkem.SQLPerm.SELECT)) { throw new Exception("PoplWS - nedostatečná oprávnění pro čtení předpisů."); } #endregion kontrola prava nad predpisy } catch (Exception exc) { resp.result = Result.ERROR; if (exc.InnerException == null) { resp.ERRORMESS = exc.Message; } else { resp.ERRORMESS = exc.InnerException.Message; } return(resp); } #endregion kontrola vstupnich udaju try { criteria = CriteriaOperator.Parse("ADR_ID = ?", osobaId); XPCollection <P_ADRESA_ROBRHS> osoba = new XPCollection <P_ADRESA_ROBRHS>(sesna, criteria); string adrIco; if (osoba.Count == 1) { adrIco = osoba.First().ADR_ICO; } else { resp.result = Result.OK; resp.status = Status.NOTEXISTS; resp.ERRORMESS = string.Format("Osoba {0} neexistuje", osobaId); return(resp); } int roku; if (!int.TryParse(System.Configuration.ConfigurationManager.AppSettings["DejPredpisy_HistRoku"], out roku)) { roku = 1; } DateTime predpisyOdRoku = new DateTime(DateTime.Now.AddYears(-1 * roku).Year, 1, 1); criteria = CriteriaOperator.Parse("CompoundKey.PRPL_ICO = ? and CompoundKey.PRPL_POPLATEK = ? " + " and PRPL_RECORD in (' ', 'P') and " + " (PRPL_VYSTAVENO > ? or PRPL_PREDPIS + PRPL_SANKCE - PRPL_SPAROVANO > 0)", adrIco, poplKod, predpisyOdRoku); XPCollection <P_PRPL> prpls = new XPCollection <P_PRPL>(sesna, criteria); foreach (var item in prpls) { if (item.USER_PREDPIS - item.PRPL_SPAROVANO_MINUSEM <= 0) { continue; } if (item.PRPL_PREDPIS < 0) { continue; } C_NAZPOPL nazpopl = sesna.GetObjectByKey <C_NAZPOPL>((decimal)poplKod); if (nazpopl != null) { resp.BANKOVNI_SPOJENI.SMER_KOD_BANKY = nazpopl.NAZPOPL_PRIJBANKA; resp.BANKOVNI_SPOJENI.CISLO_UCTU = nazpopl.NAZPOPL_PRIJUCET; resp.BANKOVNI_SPOJENI.IBAN = nazpopl.NAZPOPL_IBAN; } //zkopiruji PREDPISBaseUhr predpis = new PREDPISBaseUhr(); Utils.copy.CopyDlePersistentAttr <PREDPISBaseUhr>(item, predpis); predpis.PRPL_TYPDANE = item.PRPL_TYPDANE.TYPDANE_KOD; predpis.TYP_NAZEV = item.PRPL_TYPDANE.TYPDANE_NAZEV; predpis.POPLATEK_KOD = (int)nazpopl.NAZPOPL_POPLATEK; predpis.POPLATEK_NAZEV = nazpopl.C_NAZPOPL_NAZEV; predpis.PRPL_VS = item.PRPL_VS; decimal uhrazenoKc = 0, prKc = 0; Util.Util.DejKCReduk(ref prKc, ref uhrazenoKc, item.USER_PREDPIS, item.PRPL_SPAROVANO, item.PRPL_SPAROVANO_MINUSEM); predpis.PRPL_PREDPIS = prKc; predpis.KC_UHRAZENO = uhrazenoKc; foreach (var itemDPH in item.P_PRPL_DPH) { RADEK_DPH dph = new RADEK_DPH(); DPHRozpisPredp tmp = new DPHRozpisPredp(); Utils.copy.CopyDlePersistentAttr <DPHRozpisPredp>(itemDPH, tmp); Utils.copy.CopyDlePersistentAttr <RADEK_DPH>(tmp, dph); predpis.RADKY_DPH.Add(dph); } resp.PREDPISY.Add(predpis); } resp.result = Result.OK; if (resp.PREDPISY.Count > 0) { resp.status = Status.EXISTS; } return(resp); } catch (Exception exc) { resp.result = Result.ERROR; resp.status = Status.ERROR; resp.ERRORMESS = "Chyba při získávání seznamu předpisů."; Util.Util.WriteLog(exc.Message + "\n\n" + exc.InnerException); return(resp); } }
internal void ActualizarOrigDest( ) { //filtrar los orig/dest posibles OriginantesDisponibles.Criteria = CriteriaOperator.Parse("[<Proveedor>][^.Oid = Persona.Oid]"); DestinatariosDisponibles.Criteria = CriteriaOperator.Parse("[<Empresa>][^.Oid = Persona.Oid]"); }
/// <summary> /// Busca os valores de session e id do modulo no BD /// </summary> /// <param name="session">session</param> /// <param name="modulo">modulo</param> /// <returns>return</returns> private static XPCollection GetRequisitosPorModulo(Session session, Modulo modulo) { return(new XPCollection(session, typeof(Requisito), CriteriaOperator.Parse(String.Format("Modulo.Oid = '{0}'", modulo.Oid)))); }
private void simpleButton_imprimir_Click(object sender, EventArgs e) { if (checkButton_aserialfiscal.Checked) { orden_fecha_ascendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sesion.s_fiscal", DevExpress.Xpo.DB.SortingDirection.Ascending)); orden_fecha_descendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sesion.s_fiscal", DevExpress.Xpo.DB.SortingDirection.Ascending)); // orden_fecha_ascendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sesion.z_fiscal", DevExpress.Xpo.DB.SortingDirection.Ascending)); orden_fecha_descendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sesion.z_fiscal", DevExpress.Xpo.DB.SortingDirection.Ascending)); } else { orden_fecha_ascendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sesion.id_sesion", DevExpress.Xpo.DB.SortingDirection.Ascending)); orden_fecha_descendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sesion.id_sesion", DevExpress.Xpo.DB.SortingDirection.Ascending)); } // llview_tot_fec = (checkButton_view_tot_fechas.Checked); llview_gran_tot = (checkButton_view_gran_total.Checked); // if (this.checkEdit_todosfecha.CheckState == CheckState.Unchecked) { lfecha_desde = ((DateTime)dateTime_fecha_desde.EditValue).Date.ToShortDateString(); lfecha_hasta = ((DateTime)dateTime_fecha_hasta.EditValue).Date.ToShortDateString(); string lfecha_desde1 = lfecha_desde.Substring(6, 4) + lfecha_desde.Substring(3, 2) + lfecha_desde.Substring(0, 2); string lfecha_hasta1 = lfecha_hasta.Substring(6, 4) + lfecha_hasta.Substring(3, 2) + lfecha_hasta.Substring(0, 2); lfiltro_report = string.Format("ToStr(GetYear(fecha_hora))+PadLeft(ToStr(GetMonth(fecha_hora)),2,'0')+PadLeft(ToStr(GetDay(fecha_hora)),2,'0') >= '{0}' and ToStr(GetYear(fecha_hora))+PadLeft(ToStr(GetMonth(fecha_hora)),2,'0')+PadLeft(ToStr(GetDay(fecha_hora)),2,'0') <= '{1}'", lfecha_desde1, lfecha_hasta1); // //lfiltro_report = string.Format("GetDate(fecha_hora) >= '{0}' and GetDate(fecha_hora) <= '{1}'", ((DateTime)dateTime_fecha_desde.EditValue).Date, ((DateTime)dateTime_fecha_hasta.EditValue).Date); //lfiltro_report = string.Format("ToStr(GetDate(fecha_hora)) >= '{0}' and GetDate(fecha_hora) <= '{1}'", ((DateTime)dateTime_fecha_desde.EditValue).Date, ((DateTime)dateTime_fecha_hasta.EditValue).Date); // //XPView aaa = new XPView(XpoDefault.Session, typeof(Fundraising_PTDM.FUNDRAISING_PT.Recaudaciones)); //aaa.AddProperty("dia", "PadLeft(ToStr(GetDay(fecha_hora)),2,'0')", true, true, DevExpress.Xpo.SortDirection.None); //aaa.AddProperty("mes", "PadLeft(ToStr(GetMonth(fecha_hora)),2,'0')", true, true, DevExpress.Xpo.SortDirection.None); //aaa.AddProperty("anio", "ToStr(GetYear(fecha_hora))", true, true, DevExpress.Xpo.SortDirection.None); // } else { lfecha_desde = "Todas"; lfecha_hasta = "Todas"; lfiltro_report = "1 = 1"; } // if (this.textEdit_codigointegrado.Text.Trim() != string.Empty) { lcodigointegrado = this.textEdit_codigointegrado.Text.Trim(); lfiltro_report = lfiltro_report + " and " + string.Format("trim(tostr(sucursal))+trim(sesion.caja.codigo)+trim(sesion.cajero.codigo)+trim(tostr(sesion.id_sesion)) = '{0}'", lcodigointegrado); } else { lcodigointegrado = "Todos"; } // if (this.textEdit_serialfiscal.Text.Trim() != string.Empty) { lserialfiscal = this.textEdit_serialfiscal.Text.Trim(); lfiltro_report = lfiltro_report + " and " + string.Format("trim(sesion.s_fiscal) = '{0}'", lserialfiscal); } else { lserialfiscal = "Todos"; } // if (this.textEdit_nroz.Text.Trim() != string.Empty) { lnroz = this.textEdit_nroz.Text.Trim(); lfiltro_report = lfiltro_report + " and " + string.Format("trim(sesion.z_fiscal) = '{0}'", lnroz); } else { lnroz = "Todos"; } // if (this.checkEdit_todossucursal.CheckState == CheckState.Unchecked) { lsucursal = this.lookUpEdit_sucursal.Text; lnsucursal = (int)this.lookUpEdit_sucursal.EditValue; lfiltro_report = lfiltro_report + " and " + string.Format("sucursal = {0}", lnsucursal); } else { lsucursal = "Todas"; } // if (this.checkEdit_todos_recaudador.CheckState == CheckState.Unchecked) { lrecaudador = this.lookUpEdit_recaudador.Text; loid_recaudador = (Guid)this.lookUpEdit_recaudador.EditValue; lfiltro_report = lfiltro_report + " and " + string.Format("usuario.oid = '{0}'", loid_recaudador); } else { lrecaudador = "Todos"; } // if (this.checkEdit_todossupervisor.CheckState == CheckState.Unchecked) { lsupervisor = this.lookUpEdit_supervisor.Text; loid_supervisor = (Guid)this.lookUpEdit_supervisor.EditValue; lfiltro_report = lfiltro_report + " and " + string.Format("supervisor.oid = '{0}'", loid_supervisor); } else { lsupervisor = "Todos"; } // if (this.checkEdit_todoscajas.CheckState == CheckState.Unchecked) { lcaja = this.lookUpEdit_caja.Text; loid_caja = (Guid)this.lookUpEdit_caja.EditValue; lfiltro_report = lfiltro_report + " and " + string.Format("sesion.caja.oid = '{0}'", loid_caja); } else { lcaja = "Todos"; } // if (this.checkEdit_todoscajeros.CheckState == CheckState.Unchecked) { lcajero = this.lookUpEdit_cajero.Text; loid_cajero = (Guid)this.lookUpEdit_cajero.EditValue; lfiltro_report = lfiltro_report + " and " + string.Format("sesion.cajero.oid = '{0}'", loid_cajero); } else { lcajero = "Todos"; } // if (this.checkEdit_todosstatus_sesion.CheckState == CheckState.Unchecked) { lstatus_sesion = this.lookUpEdit_status_sesion.Text; lnstatus_sesion = (int)this.lookUpEdit_status_sesion.EditValue; lfiltro_report = lfiltro_report + " and " + string.Format("sesion.status = '{0}'", lnstatus_sesion); } else { lstatus_sesion = "Todos"; } // if (this.checkEdit_todosstatus_recaudacion.CheckState == CheckState.Unchecked) { lstatus_recaudacion = this.lookUpEdit_status_recaudacion.Text; lnstatus_recaudacion = (int)this.lookUpEdit_status_recaudacion.EditValue; switch (lntipo_reporte) { case 1: lfiltro_report = lfiltro_report + " and " + string.Format("status = '{0}'", lnstatus_recaudacion); break; case 2: lfiltro_report = lfiltro_report + " and " + string.Format("status_tv = '{0}'", lnstatus_recaudacion); break; case 3: lfiltro_report = lfiltro_report + " and " + string.Format("status = '{0}'", lnstatus_recaudacion); break; default: lfiltro_report = lfiltro_report + " and " + string.Format("status = '{0}'", lnstatus_recaudacion); break; } } else { lstatus_recaudacion = "Todos"; } // if (this.checkEdit_todostiposfp.CheckState == CheckState.Unchecked) { ltipo_fp = this.lookUpEdit_tipoformapago.Text; ltipo_forma_pago = (int)this.lookUpEdit_tipoformapago.EditValue; } else { ltipo_fp = "Todos"; ltipo_forma_pago = 0; } // if (this.checkEdit_todosdescrpf.CheckState == CheckState.Unchecked) { ldescr_fp = this.lookUpEdit_formapago.Text; loid_forma_pago = (Guid)this.lookUpEdit_formapago.EditValue; } else { ldescr_fp = "Todos"; loid_forma_pago = Guid.Empty; } // if (checkButton_order_fecha_ascendente.Checked == true) { ln_ordenfecha = 1; recaudaciones.Sorting = orden_fecha_ascendente_recaudaciones; } else { ln_ordenfecha = 2; recaudaciones.Sorting = orden_fecha_descendente_recaudaciones; } // recaudaciones.Criteria = CriteriaOperator.Parse(lfiltro_report); //IEnumerable<IGrouping<string, string>> resulgroup = from recaudaciones_grouping in recaudaciones group recaudaciones_grouping.sesion.s_fiscal by recaudaciones_grouping.sesion.z_fiscal; // switch (lntipo_reporte) { case 1: if (lookUpEdit_modeloreport.EditValue.ToString().Trim() == "0") { XtraReport_Recaudaciones1 report_recaudaciones = new XtraReport_Recaudaciones1(lfecha_desde, lfecha_hasta, lrecaudador, lsupervisor, lcaja, lcajero, ltipo_fp, ltipo_forma_pago, ldescr_fp, loid_forma_pago, lstatus_sesion, lstatus_recaudacion, llview_tot_fec, llview_gran_tot, ln_ordenfecha, lsucursal, checkButton_aserialfiscal.Checked, checkButton_anroz.Checked); report_recaudaciones.Landscape = false; report_recaudaciones.DataSource = recaudaciones; report_recaudaciones.ShowRibbonPreviewDialog(); } else { XtraReport_Recaudaciones report_recaudaciones = new XtraReport_Recaudaciones(lfecha_desde, lfecha_hasta, lrecaudador, lsupervisor, lcaja, lcajero, ltipo_fp, ltipo_forma_pago, ldescr_fp, loid_forma_pago, lstatus_sesion, lstatus_recaudacion, llview_tot_fec, llview_gran_tot, ln_ordenfecha, lsucursal, checkButton_aserialfiscal.Checked, checkButton_anroz.Checked); report_recaudaciones.Landscape = true; report_recaudaciones.DataSource = recaudaciones; report_recaudaciones.ShowRibbonPreviewDialog(); } break; case 2: if (lookUpEdit_modeloreport.EditValue.ToString().Trim() == "0") { XtraReport_Totales_Ventas1 report_totales_ventas = new XtraReport_Totales_Ventas1(lfecha_desde, lfecha_hasta, lrecaudador, lsupervisor, lcaja, lcajero, ltipo_fp, ltipo_forma_pago, ldescr_fp, loid_forma_pago, lstatus_sesion, lstatus_recaudacion, llview_tot_fec, llview_gran_tot, ln_ordenfecha, lsucursal, checkButton_aserialfiscal.Checked, checkButton_anroz.Checked); report_totales_ventas.Landscape = false; report_totales_ventas.DataSource = recaudaciones; report_totales_ventas.ShowRibbonPreviewDialog(); } else { XtraReport_Totales_Ventas report_totales_ventas = new XtraReport_Totales_Ventas(lfecha_desde, lfecha_hasta, lrecaudador, lsupervisor, lcaja, lcajero, ltipo_fp, ltipo_forma_pago, ldescr_fp, loid_forma_pago, lstatus_sesion, lstatus_recaudacion, llview_tot_fec, llview_gran_tot, ln_ordenfecha, lsucursal, checkButton_aserialfiscal.Checked, checkButton_anroz.Checked); report_totales_ventas.Landscape = true; report_totales_ventas.DataSource = recaudaciones; report_totales_ventas.ShowRibbonPreviewDialog(); } break; case 3: if (lookUpEdit_modeloreport.EditValue.ToString().Trim() == "0") { XtraReport_Diferencias_VR2 report_diferencias = new XtraReport_Diferencias_VR2(recaudaciones, lfecha_desde, lfecha_hasta, lrecaudador, lsupervisor, lcaja, lcajero, ltipo_fp, ltipo_forma_pago, ldescr_fp, loid_forma_pago, lstatus_sesion, lstatus_recaudacion, llview_tot_fec, llview_gran_tot, ln_ordenfecha, lsucursal); report_diferencias.Landscape = false; report_diferencias.ShowRibbonPreviewDialog(); } else { XtraReport_Diferencias_VR report_diferencias = new XtraReport_Diferencias_VR(recaudaciones, lfecha_desde, lfecha_hasta, lrecaudador, lsupervisor, lcaja, lcajero, ltipo_fp, ltipo_forma_pago, ldescr_fp, loid_forma_pago, lstatus_sesion, lstatus_recaudacion, llview_tot_fec, llview_gran_tot, ln_ordenfecha, lsucursal); report_diferencias.Landscape = true; report_diferencias.ShowRibbonPreviewDialog(); } break; } }
public void UnsubscribeEvents() { ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false); MoviesListView moviesListView1 = MoviesListView.LastCreatedView; moviesListView1.Module.Dispose(); ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false); MoviesListView moviesListView2 = MoviesListView.LastCreatedView; moviesListView2.Module.OpenDetail(Avatar.Oid); MovieDetailView detail = MovieDetailView.LastCreatedView; Movie avatar = new XPCollection <Movie>(moviesListView2.Module.MoviesEdit.VRObjectsEditObject.VideoRentObjects, CriteriaOperator.Parse("Oid = ?", Avatar.Oid))[0]; detail.Module.MovieEdit.VRObjectEditObject.VideoRentObject.Plot += "_Updated"; detail.Module.SaveAndDispose(); moviesListView2.Module.Dispose(); }
public UI_Report_Recauda(DevExpress.XtraBars.BarButtonItem opcionMenu, DevExpress.XtraBars.BarHeaderItem headerMenu, object objetoExtra) { WaitForm1 WaitForm1 = new WaitForm1(); DevExpress.XtraSplashScreen.SplashScreenManager.ShowForm(WaitForm1, typeof(WaitForm1), false, false, false); switch ((int)objetoExtra) { case 1: DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Reporte de Recaudaciones..."); break; case 2: DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Reporte de Totales de Ventas..."); break; case 3: DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Reporte de Diferencias (Ventas-Recaudaciones)..."); break; default: DevExpress.XtraSplashScreen.SplashScreenManager.Default.SetWaitFormCaption("Reporte de Recaudaciones..."); break; } // InitializeComponent(); this.SetStyle(ControlStyles.ResizeRedraw, true); // OpcionMenu = opcionMenu; HeaderMenu = headerMenu; ObjetoExtra = objetoExtra; lHeader_ant = HeaderMenu.Caption; if (objetoExtra != null) { lntipo_reporte = (int)objetoExtra; } // orden_fecha_ascendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sucursal", DevExpress.Xpo.DB.SortingDirection.Ascending)); orden_fecha_descendente_recaudaciones.Add(new DevExpress.Xpo.SortProperty("sucursal", DevExpress.Xpo.DB.SortingDirection.Ascending)); // CriteriaOperator filtro_status = (new OperandProperty("status") == new OperandValue(1)); CriteriaOperator filtro_recaudaciones = CriteriaOperator.Parse("1 = 2"); DevExpress.Xpo.SortingCollection orden_formas_pagos = new DevExpress.Xpo.SortingCollection(new DevExpress.Xpo.SortProperty("tpago", DevExpress.Xpo.DB.SortingDirection.Ascending)); orden_formas_pagos.Add(new DevExpress.Xpo.SortProperty("codigo", DevExpress.Xpo.DB.SortingDirection.Ascending)); DevExpress.Xpo.SortProperty orden_recaudaciones = (new DevExpress.Xpo.SortProperty("fecha_hora", DevExpress.Xpo.DB.SortingDirection.Ascending)); // sucursales = new DevExpress.Xpo.XPCollection <Fundraising_PTDM.FUNDRAISING_PT.Sucursales>(DevExpress.Xpo.XpoDefault.Session, filtro_status, new DevExpress.Xpo.SortProperty("codigo", DevExpress.Xpo.DB.SortingDirection.Ascending)); recaudaciones = new DevExpress.Xpo.XPCollection <Fundraising_PTDM.FUNDRAISING_PT.Recaudaciones>(DevExpress.Xpo.XpoDefault.Session, filtro_recaudaciones, orden_recaudaciones); formas_pagos = new DevExpress.Xpo.XPCollection <Fundraising_PTDM.FUNDRAISING_PT.Formas_Pagos>(DevExpress.Xpo.XpoDefault.Session, filtro_status, new DevExpress.Xpo.SortProperty("tpago", DevExpress.Xpo.DB.SortingDirection.Ascending)); formas_pagos.Sorting = orden_formas_pagos; usuarios = new DevExpress.Xpo.XPCollection <Fundraising_PTDM.FUNDRAISING_PT.Usuarios>(DevExpress.Xpo.XpoDefault.Session, filtro_status, new DevExpress.Xpo.SortProperty("usuario", DevExpress.Xpo.DB.SortingDirection.Ascending)); cajas = new DevExpress.Xpo.XPCollection <Fundraising_PTDM.FUNDRAISING_PT.Cajas>(DevExpress.Xpo.XpoDefault.Session, filtro_status, new DevExpress.Xpo.SortProperty("codigo", DevExpress.Xpo.DB.SortingDirection.Ascending)); cajeros = new DevExpress.Xpo.XPCollection <Fundraising_PTDM.FUNDRAISING_PT.Cajeros>(DevExpress.Xpo.XpoDefault.Session, filtro_status, new DevExpress.Xpo.SortProperty("cajero", DevExpress.Xpo.DB.SortingDirection.Ascending)); // bindingSource_sucursales.DataSource = sucursales; bindingSource_recaudadores.DataSource = usuarios; bindingSource_supersisores.DataSource = usuarios; bindingSource_cajas.DataSource = cajas; bindingSource_cajeros.DataSource = cajeros; bindingSource_formas_pagos.DataSource = formas_pagos; }
public void UnsubscribeEvents() { ModulesManager.Current.OpenModuleObjectDetail(new ArtistsListObject(Session), false); ArtistsListView artistsListView1 = ArtistsListView.LastCreatedView; artistsListView1.Module.Dispose(); ModulesManager.Current.OpenModuleObjectDetail(new ArtistsListObject(Session), false); ArtistsListView artistsListView2 = ArtistsListView.LastCreatedView; artistsListView2.Module.OpenDetail(JamesCameron.Oid); ArtistDetailView detail = ArtistDetailView.LastCreatedView; Artist jamesCameron = new XPCollection <Artist>(artistsListView2.Module.ArtistsEdit.VRObjectsEditObject.VideoRentObjects, CriteriaOperator.Parse("FullName = ?", JamesCameron.FullName))[0]; detail.Module.ArtistEdit.VRObjectEditObject.VideoRentObject.Biography += "_Updated"; detail.Module.SaveAndDispose(); artistsListView2.Module.Dispose(); }
/// <summary> /// 查询条件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void barButtonItem10_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { Frm_TombSearch frm_1 = new Frm_TombSearch(); if (frm_1.ShowDialog() == DialogResult.OK) { this.Cursor = Cursors.WaitCursor; string s_ac001 = frm_1.swapdata["ac001"].ToString(); string s_ac003 = frm_1.swapdata["ac003"].ToString(); string s_ac050 = frm_1.swapdata["ac050"].ToString(); string s_rg001 = frm_1.swapdata["rg001"].ToString(); string s_bi003 = frm_1.swapdata["bi003"].ToString(); string s_ac113 = frm_1.swapdata["ac113"].ToString(); string s_criteria = string.Empty; string s_range = string.Empty; if (s_ac001 != "%") { s_criteria = "AC001='" + s_ac001 + "'"; } else { if (s_ac050 == "%") { s_criteria = @"AC001 like '" + s_ac001 + "' and " + "AC003 like '" + s_ac003 + "' and " + "AC010 like '" + s_rg001 + "' and " + "BI003 like '" + s_bi003 + "'"; } else { s_criteria = @"AC001 like '" + s_ac001 + "' and " + "AC003 like '" + s_ac003 + "' and " + "AC050 like '" + s_ac050 + "' and " + "AC010 like '" + s_rg001 + "' and " + "BI003 like '" + s_bi003 + "'"; } if (s_ac113 != "%") { s_criteria += " and AC330 like '" + s_ac113 + "' "; } if (frm_1.swapdata.ContainsKey("range")) { switch (frm_1.swapdata["range"].ToString()) { case "当日": s_range = "( AC200 >= #" + Tools.GetServerDate().ToString("yyyy-MM-dd") + "# and AC200 < #" + Tools.GetServerDate().AddDays(1).ToString("yyyy-MM-dd") + "#)"; break; case "一周以内": s_range = "( AC200 >= #" + Tools.GetServerDate().AddDays(-7).ToString("yyyy-MM-dd") + "# and AC200 < #" + Tools.GetServerDate().AddDays(1).ToString("yyyy-MM-dd") + "#)"; break; case "一月以内": s_range = "( AC200 >= #" + Tools.GetServerDate().AddDays(-30).ToString("yyyy-MM-dd") + "# and AC200 < #" + Tools.GetServerDate().AddDays(1).ToString("yyyy-MM-dd") + "#)"; break; } s_criteria += " and " + s_range; } } CriteriaOperator criteria = CriteriaOperator.Parse(s_criteria); xpCollection_ac01.Criteria = criteria; xpCollection_ac01.LoadingEnabled = true; this.Cursor = Cursors.Arrow; } frm_1.Dispose(); }
public void ChangeMovieByDetail_CheckUpdateInMoviesList() { ModulesManager.Current.OpenModuleObjectDetail(new MoviesListObject(Session), false); MoviesListView moviesListView = MoviesListView.LastCreatedView; moviesListView.Module.OpenDetail(Avatar.Oid); MovieDetailView detail = MovieDetailView.LastCreatedView; Movie avatar = new XPCollection <Movie>(moviesListView.Module.MoviesEdit.VRObjectsEditObject.VideoRentObjects, CriteriaOperator.Parse("Oid = ?", Avatar.Oid))[0]; detail.Module.MovieEdit.VRObjectEditObject.VideoRentObject.Plot += "_Updated"; string updatedPlot = detail.Module.MovieEdit.VRObjectEditObject.VideoRentObject.Plot; detail.Module.SaveAndDispose(); Assert.AreEqual(updatedPlot, avatar.Plot); moviesListView.Module.Dispose(); }
void workerImport_DoWork(object sender, DoWorkEventArgs e) { DateTime t0 = DateTime.Now; int createSuccessCount = 0; int updateSuccessCount = 0; int faultCount = 0; int delay = 50; bool isUpdating = false; int index = 0; double progress = 0; int count = 0; try { //string nodeName = Environment.MachineName; string nodeName = Global.Default.varXml.SystemPlatform.NodeName; string galaxyName = Global.Default.varXml.SystemPlatform.GalaxyName; // create GRAccessAppClass object GRAccessApp grAccess = new GRAccessAppClass(); Report(string.Format("Подключение к Galaxy ({0}/{1})...\r\n", nodeName, galaxyName)); // try to get galaxy IGalaxies gals = grAccess.QueryGalaxies(nodeName); if (gals == null || grAccess.CommandResult.Successful == false) { Report(string.Format("Error!\r\nCustomMessage - {0}\r\nCommandResult - {1}\r\n", grAccess.CommandResult.CustomMessage, grAccess.CommandResult.Text)); return; } else { Report("Подключен.\r\n"); } IGalaxy galaxy = gals[galaxyName]; string login = Global.Default.varXml.SystemPlatform.Login; string password = Global.Default.varXml.SystemPlatform.Password; Report(string.Format("Авторизация {0}/{1}...\r\n", login, password)); // log in galaxy.Login(login, password); ICommandResult cmd; cmd = galaxy.CommandResult; if (!cmd.Successful) { Report("Ошибка авторизации:" + cmd.Text + " : " + cmd.CustomMessage + "\r\n"); return; } else { Report("Авторизован.\r\n"); } string instanceName = ""; IgObjects queryResult; string[] tagnames = new string[1]; XPCollection <Object> objects = new XPCollection <Object>(); objects.Criteria = CriteriaOperator.Parse("[ArchestrAImport]"); count = objects.Count; foreach (Object obj in objects) { index++; try { if (obj.ObjectTypeID != null) { if (!string.IsNullOrEmpty(obj.ObjectTypeID.ArchestrATemplate)) { instanceName = obj.Attribute; tagnames[0] = instanceName; queryResult = galaxy.QueryObjectsByName( EgObjectIsTemplateOrInstance.gObjectIsInstance, ref tagnames); IInstance instance = null; cmd = galaxy.CommandResult; try { instance = (IInstance)queryResult[1]; isUpdating = true; } catch { isUpdating = false; } if (isUpdating) { updateSuccessCount++; } else { // get the $UserDefined template tagnames[0] = obj.ObjectTypeID.ArchestrATemplate; queryResult = galaxy.QueryObjectsByName( EgObjectIsTemplateOrInstance.gObjectIsTemplate, ref tagnames); cmd = galaxy.CommandResult; if (!cmd.Successful) { meResultArchestrA.Text = "Ошибка инициализации шаблона:" + cmd.Text + " : " + cmd.CustomMessage + "\r\n"; } ITemplate userDefinedTemplate = (ITemplate)queryResult[1]; // create an instance instance = userDefinedTemplate.CreateInstance(instanceName, true); createSuccessCount++; isUpdating = false; } instance.CheckOut(); MxValue mxName = new MxValueClass(); mxName.PutString(obj.Chart); instance.Attributes[Global.Default.varXml.SystemPlatform.NameField].SetValue(mxName); MxValue mxDescription = new MxValueClass(); mxDescription.PutString(obj.Comment); instance.Attributes[Global.Default.varXml.SystemPlatform.DescriptionField].SetValue(mxDescription); if (obj.ObjectTypeID.IsRealType) { MxValue mxPointNum = new MxValueClass(); mxPointNum.PutInteger(obj.PointNum); instance.Attributes[Global.Default.varXml.SystemPlatform.PointNumField].SetValue(mxPointNum); MxValue mxUnit = new MxValueClass(); mxUnit.PutString(obj.Unit); instance.Attributes[Global.Default.varXml.SystemPlatform.UnitField].SetValue(mxUnit); } instance.Save(); instance.CheckIn("Check in after adding."); progress = ((double)index / objects.Count * 1000); progressPossition = (int)Math.Round(progress); if (!isUpdating) { Report(string.Format("Объект {0} создан удачно.\r\n", instanceName)); } else { Report(string.Format("Объект {0} обновлен удачно.\r\n", instanceName)); } } } } catch (Exception ex) { Report(string.Format("У объекта {0} есть проблема создания :( [{1} -> {2}] \r\n", instanceName, ex.Message, ex.InnerException)); faultCount++; } } galaxy.Logout(); Thread.Sleep(delay); Report(string.Format("Отключение от галактики выполнено. \r\n")); Thread.Sleep(delay); } catch (Exception ex) { meResultArchestrA.Text = ex.Message + "->" + ex.InnerException + "\r\n"; } TimeSpan diff = DateTime.Now - t0; Report(string.Format("Было потрачено времени: {0} c.\r\n", diff.ToString())); Thread.Sleep(delay); Report(string.Format("Среднее время на один объект: {0:0.#} c.\r\n", diff.TotalSeconds / count)); Thread.Sleep(delay); Report(string.Format("Удачно созданных: {0}.\r\n", createSuccessCount)); Thread.Sleep(delay); Report(string.Format("Удачно обновленных: {0}.\r\n", updateSuccessCount)); Thread.Sleep(delay); Report(string.Format("Неудачно выполненных команд: {0}. \r\n", faultCount)); Thread.Sleep(delay); }
public ActionResult SupplierList(string companycode) { try { GenHelper.WriteLog("[Log]", "[" + securityProvider.GetUserName() + "]" + controllername + "-SupplierList(" + companycode + "):[" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); List <vwBusinessPartners> existing = objectSpace.GetObjects <vwBusinessPartners>(CriteriaOperator.Parse("CompanyCode=? and CardType=?", companycode, "S")).ToList(); if (existing == null) { NotFound(); } return(Ok(existing)); } catch (Exception ex) { GenHelper.WriteLog("[Error]", "[" + securityProvider.GetUserName() + "]" + controllername + "-SupplierList(" + companycode + "):[" + ex.Message + "][" + DateTime.Now.ToString("yyyy-MM-dd hh:mm:ss tt") + "]"); throw new Exception(ex.Message); } }
public static void DeserializeBodyPacket(int rowsCount, Type[] types, AvrDataTable table, Func <Stream> streamCreator) { Utils.CheckNotNull(types, "types"); Utils.CheckNotNull(streamCreator, "streamCreator"); Stream stream = streamCreator(); if (stream == null) { throw new AvrException("Could not deserialize avr table packet: stream creator is null"); } int colsCount = types.Length; var internIndexes = new int[colsCount]; var internStrings = new string[colsCount][]; for (int i = 0; i < internStrings.Length; i++) { internStrings[i] = new string[sbyte.MaxValue]; } ExpressionEvaluator filter = null; if (!string.IsNullOrEmpty(table.RowFilterExpression)) { var descriptor = new AvrRowEvaluatorContextDescriptor(table); var criteriaOperator = CriteriaOperator.Parse(table.RowFilterExpression); filter = new ExpressionEvaluator(descriptor, criteriaOperator); } var rowDTO = CreateAvrDataRowDTO(types); using (var reader = new BinaryReader(stream)) { for (int i = 0; i < rowsCount; i++) { for (int j = 0; j < colsCount; j++) { sbyte status = reader.ReadSByte(); if (status > 0) { Type type = types[j]; if (type == m_TypeOfString) { string val; var internIndex = internIndexes[j]; if (internIndex < sbyte.MaxValue) { if (status == 1) { val = reader.ReadString(); internStrings[j][internIndex] = val; internIndexes[j] = internIndex + 1; } else { val = internStrings[j][status - 2]; } } else { val = reader.ReadString(); } rowDTO.SetObject(j, val); } else if (type == m_TypeOfDateTime) { var value = new DateTime(reader.ReadInt64()); rowDTO.SetDateTime(j, value); } else if (type == m_TypeOfInt32) { rowDTO.SetInt(j, reader.ReadInt32()); } else if (type == m_TypeOfInt64) { rowDTO.SetObject(j, reader.ReadInt64()); } else if (type == m_TypeOfInt16) { rowDTO.SetObject(j, reader.ReadInt16()); } else if (type == m_TypeOfDouble) { rowDTO.SetObject(j, reader.ReadDouble()); } else if (type == m_TypeOfDecimal) { rowDTO.SetObject(j, reader.ReadDecimal()); } else if (type == m_TypeOfSingle) { rowDTO.SetObject(j, reader.ReadSingle()); } else if (type == m_TypeOfBoolean) { rowDTO.SetObject(j, reader.ReadBoolean()); } else if (type == m_TypeOfByte) { rowDTO.SetObject(j, reader.ReadByte()); } } } AvrDataRowBase newRow = table.NewRow(rowDTO); if (filter == null || filter.Fit(newRow)) { table.ThreadSafeAdd(newRow); } rowDTO.Reset(); } } stream.Dispose(); }
public void support_list_header(string TK_fFinancialAccountDim, FinancialSalesOrManufactureExpenseSummary_Fact FinancialFact_General, int CorrespondFinancialAccountDimId_default, List <string> list_header ) { FinancialAccountDim fFinancialAccountDim = session.FindObject <FinancialAccountDim>( CriteriaOperator.Parse(String.Format( "Code='{0}'", TK_fFinancialAccountDim))); if (FinancialFact_General != null && fFinancialAccountDim != null) { SalesOrManufactureExpenseByGroup SalesByGroup = session.FindObject < SalesOrManufactureExpenseByGroup>(CriteriaOperator.Parse( String.Format("FinancialSalesOrManufactureExpenseSummary_FactId='{0}' AND " + "FinancialAccountDimId='{1}' AND RowStatus='1'", FinancialFact_General.FinancialSalesOrManufactureExpenseSummary_FactId, fFinancialAccountDim.FinancialAccountDimId ))); if (SalesByGroup != null) { XPCollection <FinancialSalesOrManufactureExpenseDetail> collect_Detail = new XPCollection <FinancialSalesOrManufactureExpenseDetail>(session, CriteriaOperator.Parse( String.Format("SalesOrManufactureExpenseByGroupId='{0}' AND " + "CorrespondFinancialAccountDimId!='{1}' AND " + "Credit>0 AND " + "RowStatus='1'", SalesByGroup.SalesOrManufactureExpenseByGroupId, CorrespondFinancialAccountDimId_default ))); if (collect_Detail.Count != 0) { foreach (FinancialSalesOrManufactureExpenseDetail each_Detail in collect_Detail) { if (!list_header.Contains(each_Detail.CorrespondFinancialAccountDimId.Code)) { list_header.Add(each_Detail.CorrespondFinancialAccountDimId.Code); } } } } } }
private void SetCustomFilter(string temp, ProductCategory category) { viewProducts.ActiveFilter.Clear(); viewProducts.ActiveFilter.Add(viewProducts.Columns["Name"], new ColumnFilterInfo(CriteriaOperator.Parse(String.Format("Name like '%{0}%'", temp)))); viewProducts.ActiveFilter.Add(viewProducts.Columns["Category"], new ColumnFilterInfo(CriteriaOperator.Parse("Category == ?", category))); }
public List <string> support_find_row_TK(FinancialSalesOrManufactureExpenseSummary_Fact FinancialFact_General, string TK) { List <string> contain_fc = new List <string>(); FinancialAccountDim fFinancialAccountDim = session.FindObject <FinancialAccountDim>( CriteriaOperator.Parse(String.Format( "Code='{0}'", TK))); if (FinancialFact_General != null && fFinancialAccountDim != null) { SalesOrManufactureExpenseByGroup SalesByGroup = session.FindObject < SalesOrManufactureExpenseByGroup>(CriteriaOperator.Parse( String.Format("FinancialSalesOrManufactureExpenseSummary_FactId='{0}' AND " + "FinancialAccountDimId='{1}' AND RowStatus='1'", FinancialFact_General.FinancialSalesOrManufactureExpenseSummary_FactId, fFinancialAccountDim.FinancialAccountDimId ))); if (SalesByGroup != null) { XPCollection <FinancialSalesOrManufactureExpenseDetail> find_fc_throw_detail = new XPCollection <FinancialSalesOrManufactureExpenseDetail>(session, CriteriaOperator.Parse( String.Format("SalesOrManufactureExpenseByGroupId='{0}' AND " + "CorrespondFinancialAccountDimId='128' AND " + "Debit>0 AND " + "RowStatus='1'", SalesByGroup.SalesOrManufactureExpenseByGroupId ))); if (find_fc_throw_detail.Count != 0) { foreach (FinancialSalesOrManufactureExpenseDetail each_detail in find_fc_throw_detail) { if (!contain_fc.Contains(each_detail.FinancialAccountDimId.Code)) { contain_fc.Add(each_detail.FinancialAccountDimId.Code); // nếu tồn tại con thì lấy cha if (!contain_fc.Contains(TK)) { contain_fc.Add(TK); } } } } } } contain_fc.Sort(); return(contain_fc); }
void UpdateTileFilter(TileItem tileItem) { string filter = (string)tileItem.Tag; if (filter == currentFilter) { return; } currentFilter = filter; ProductCategory category = ProductCategory.Automation; if (!Enum.TryParse <ProductCategory>(currentFilter, out category)) { currentFilter = null; } viewProducts.ActiveFilter.Clear(); if (currentFilter != null) { viewProducts.ActiveFilter.Add(viewProducts.Columns["Category"], new ColumnFilterInfo(CriteriaOperator.Parse("Category == ?", category))); } tileItem.Text = viewProducts.RowCount.ToString(); }
private void btnFinalizar_Execute(object sender, SimpleActionExecuteEventArgs e) { if (View.Id == "SubTarefa_ListView") { //Converte Objeto Selecionado em SubTarefa SubTarefa SubT = (SubTarefa)e.CurrentObject; //Procura em SubTarefa Status em: EmExecução, Pendente, Pausado, Reprovado, Aprovado, EmTeste //IEnumerable<SubTarefa> subtarefas = SubT.Tarefa.SubTarefa.Where(x => x.StatusSubTarefa != StatusSubTarefaEnum.Finalizado //&& x.StatusSubTarefa != StatusSubTarefaEnum.Cancelado && x.Tarefa == SubT.Tarefa); //Procura SubTarefas com Status EmExecução ou Pausado //Se Ecnontrou StatusSubTarefa = Finalizado if (SubT.StatusSubTarefa == StatusSubTarefaEnum.EmDesenvolvimento || SubT.StatusSubTarefa == StatusSubTarefaEnum.Pausado || SubT.StatusSubTarefa == StatusSubTarefaEnum.EmTeste || SubT.StatusSubTarefa == StatusSubTarefaEnum.TestePausado) { if (SubT.EmTeste) { SubT.StatusSubTarefa = StatusSubTarefaEnum.TesteFinalizado; SubT.Save(); } else { SubT.StatusSubTarefa = StatusSubTarefaEnum.Desenvolvido; SubT.Save(); } TempoTarefa _horaPausa = SubT.HistoricoTempo.FirstOrDefault(x => x.HoraFim == TimeSpan.Parse("00:00:00")); if (_horaPausa != null) { _horaPausa.HoraFim = DateTime.Now.TimeOfDay; _horaPausa.Save(); } #region Verifica Status Tarefa Mãe //Cria Collection de Todas subTarefas da Mesma tarefa XPCollection <SubTarefa> sub = new XPCollection <SubTarefa>(((XPObjectSpace)ObjectSpace).Session, CriteriaOperator.Parse("[Tarefa] = ?", SubT.Tarefa)); int num = 0; foreach (SubTarefa item in sub) { if (item.StatusSubTarefa != StatusSubTarefaEnum.Desenvolvido && item.StatusSubTarefa != StatusSubTarefaEnum.Cancelado && item.StatusSubTarefa != StatusSubTarefaEnum.Aprovado) { num += 1; } } //Se NÃO encontrou Sub Tarefa com Status entre EmExecução, Pendente, Pausado, Reprovado, Aprovado, EmTeste //Tarefa MÃE pode ser Finalizada por que Todas suas SubTarefas Estão Finalizadas ou Canceladas //valor 1 pq Status (SubTarefa) do objeto atual ainda não esta Finalizado ou Cancelado if (num == 0) { //Tarefa MÃE será Finalizada SubT.Tarefa.StatusTarefa = StatusTarefaEnum.Desenvolvido; } #endregion } #region Atualiza Status Projeto Principal ////Faz Busca de Tarefas do Mesmo Projeto //XPCollection<Tarefa> tarefas = new XPCollection<Tarefa>(((XPObjectSpace)ObjectSpace).Session, CriteriaOperator.Parse("[Projeto] = ?", SubT.Tarefa.Projeto)); //int cont = 0; //foreach (Tarefa itemTarefa in tarefas) //{ // if (itemTarefa.StatusTarefa != StatusTarefaEnum.Cancelado && itemTarefa.StatusTarefa != StatusTarefaEnum.Finalizado) // { // cont += 1; // } //} ////Se Todas Tarefas Estiverem Finalizadas O Projeto Pai Será Finalizado ////Igual a "0" por Objeto (Tarefa) ja foi finalizada //if (cont == 0) //{ // //Projeto Pai será Finalizado // SubT.Tarefa.Projeto.StatusProjeto = StatusProjetoEnum.Finalizado; // SubT.Tarefa.Projeto.DataFim = DateTime.Now; //} #endregion ObjectSpace.CommitChanges(); } View.Refresh(); }
private VendorContact VendorContact(string EmailAddress, string FirstName, string LastName) { VendorContact vendorContact = this.DataSourceHelper.Session.FindObject <VendorContact>(CriteriaOperator.Parse(string.Format("Email = '{0}'", EmailAddress))); if (vendorContact == null) { vendorContact = new VendorContact(this.DataSourceHelper.Session) { FirstName = FirstName, LastName = LastName, Email = EmailAddress }; vendorContact.Save(); } return(vendorContact); }