private void DoCreate(IPluginExecutionContext context, IOrganizationService orgService) { Guid invoiceId = context.PrimaryEntityId; Entity invoice = orgService.Retrieve(context.PrimaryEntityName, context.PrimaryEntityId, new ColumnSet(true)); if (invoice.Contains("new_invoicetype") == false) { return; } EnumInvoiceType invoiceType = (EnumInvoiceType)((invoice["new_invoicetype"] as OptionSetValue).Value); if (invoiceType == EnumInvoiceType.NewBuy) { return; } if (invoice.Contains("customerid") == false) { return; } EntityReference accRef = invoice["customerid"] as EntityReference; Entity acc = orgService.Retrieve(accRef.LogicalName, accRef.Id, new ColumnSet(true)); if (acc.Contains("new_regularflag") == true && (bool)acc["new_regularflag"] == true) { return; } UpdateAccountRegularFlag(orgService, accRef, IsRegularAccount(accRef, orgService)); }
internal void GetInvoice(EnumInvoiceType invoiceType) { if (invoiceType == EnumInvoiceType.WithHeader) { aInvoiceCreater = new InvoiceWithHeader(); aInvoiceCreater.PerformAction(); } else if (invoiceType == EnumInvoiceType.WithOutHeader) { aInvoiceCreater = new InvoiceWithoutHeader(); aInvoiceCreater.PerformAction(); } }
public ArrayList SelectInvoices(string personID, EnumInvoiceType invoiceType, bool isGroup) { string strSql = ""; if (this.Sql.GetSql("Fee.InvoiceService.SelectInvoices.ByIdTypeIsGroup", ref strSql) == -1) { return(null); } try { //0领取时间1发票种类2领取人3发票开始号4发票终止号5发票已用号 //6 used_state7公用标志 string typeid = invoiceType.ToString(); strSql = string.Format(strSql, personID, typeid, isGroup == true ? 1 : 0); } catch (Exception ex) { this.ErrCode = ex.Message; this.Err = ex.Message; return(null); } return(QueryInvoicesBySql(strSql)); }