public void CRUD_LegalInvoiceArtifact_Creating() { try { Clear_AllFrom(); #region Create new LegalInvoiceArtifact NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact legalInvoiceArtifact_ID = new NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact(session); legalInvoiceArtifact_ID.LegalInvoiceArtifactId = Guid.NewGuid(); legalInvoiceArtifact_ID.RowStatus = Utility.Constant.ROWSTATUS_TEMP; legalInvoiceArtifact_ID.CreateDate = DateTime.Now; session.CommitTransaction(); //set session LegalInvoiceArtifactId LegalInvoiceArtifactId = legalInvoiceArtifact_ID.LegalInvoiceArtifactId; #endregion #region LegalInvoiceArtifactIdentifier string[] Identifier_name = { "SERIES", "NUMBER", "TEMPLATE" }; for (int i = 0; i < Identifier_name.Length; i++) { LegalInvoiceArtifactIdentifierType identifiertype = BO.get_IdentifierTypeId(session, Identifier_name[i]); if (identifiertype != null) { LegalInvoiceArtifactIdentifier identifier = new LegalInvoiceArtifactIdentifier(session); identifier.LegalInvoiceArtifactId = legalInvoiceArtifact_ID; identifier.LegalInvoiceArtifactIdentifierTypeId = identifiertype; identifier.RowStatus = Utility.Constant.ROWSTATUS_TEMP; session.CommitTransaction(); } } #endregion #region LegalInvoiceArtifactOrgActor string[] orgActorType = { "S", "B" }; for (int i = 0; i < orgActorType.Length; i++) { LegalInvoiceArtifactOrgActor orgActor_sell = new LegalInvoiceArtifactOrgActor(session); orgActor_sell.LegalInvoiceArtifactId = legalInvoiceArtifact_ID; orgActor_sell.OrgActorType = char.Parse(orgActorType[i]); orgActor_sell.RowStatus = Utility.Constant.ROWSTATUS_TEMP; session.CommitTransaction(); } #endregion } catch (Exception) { throw; } }
public LegalInvoiceArtifactIdentifierType get_IdentifierTypeId(Session session, string Name) { try { LegalInvoiceArtifactIdentifierType id_indentifier = session.FindObject <LegalInvoiceArtifactIdentifierType>( CriteriaOperator.And( new BinaryOperator("Name", Name, BinaryOperatorType.Equal), new BinaryOperator("RowStatus", 0, BinaryOperatorType.Greater) )); if (id_indentifier == null) { return(null); } return(id_indentifier); } catch (Exception) { throw; } }
public void CRUD_LegalInvoiceArtifact_Deleting() { try { if (using_state.Equals("Creating")) { #region Hoa don GTGT NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact artifact = BO.get_LegalInvoiceArtifactId(session, LegalInvoiceArtifactId, Utility.Constant.ROWSTATUS_TEMP.ToString()); artifact.RowStatus = Utility.Constant.ROWSTATUS_DELETED; session.CommitTransaction(); //save string[] Identifier_name = { "SERIES", "NUMBER", "TEMPLATE" }; for (int i = 0; i < Identifier_name.Length; i++) { LegalInvoiceArtifactIdentifierType identifiertype = BO.get_IdentifierTypeId(session, Identifier_name[i]); LegalInvoiceArtifactIdentifier identifier = BO.get_LegalInvoiceArtifactIdentifier(session, LegalInvoiceArtifactId, identifiertype.LegalInvoiceArtifactIdentifierTypeId, Utility.Constant.ROWSTATUS_TEMP.ToString()); if (identifiertype != null && identifier.LegalInvoiceArtifactId.LegalInvoiceArtifactId.Equals(LegalInvoiceArtifactId)) { identifier.RowStatus = Utility.Constant.ROWSTATUS_DELETED; session.CommitTransaction(); //save } } #endregion #region thong tin mua - ban string[] orgActorType = { "S", "B" }; for (int i = 0; i < orgActorType.Length; i++) { LegalInvoiceArtifactOrgActor orgActor_sell = BO.get_OrgActorId(session, LegalInvoiceArtifactId, orgActorType[i], Utility.Constant.ROWSTATUS_TEMP.ToString()); orgActor_sell.RowStatus = Utility.Constant.ROWSTATUS_DELETED; session.CommitTransaction(); } #endregion } } catch (Exception) { throw; } }
public void CRUD_LegalInvoiceArtifact_Editing() { try { #region load LegalInvoiceArtifact NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact legalInvoiceArtifact_ID = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact>(LegalInvoiceArtifactId); NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType artifactType_code = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType>(Guid.Parse(legalInvoiceArtifact_ID.LegalInvoiceArtifactTypeId.LegalInvoiceArtifactTypeId.ToString())); if (artifactType_code == null) { throw new Exception("LegalInvoiceArtifactType is not exist system"); } txt_Code_Artifact.Text = legalInvoiceArtifact_ID.Code; txt_IssuedDate_Artifact.Date = legalInvoiceArtifact_ID.IssuedDate; cbo_Code_ArtifactType.Text = artifactType_code.Code; #endregion #region load LegalInvoiceArtifactIdentifier string[] Identifier_name = { "SERIES", "NUMBER", "TEMPLATE" }; for (int i = 0; i < Identifier_name.Length; i++) { LegalInvoiceArtifactIdentifierType identifiertype = BO.get_IdentifierTypeId(session, Identifier_name[i]); LegalInvoiceArtifactIdentifier identifier = BO.get_LegalInvoiceArtifactIdentifier(session, LegalInvoiceArtifactId, identifiertype.LegalInvoiceArtifactIdentifierTypeId, Utility.Constant.ROWSTATUS_ACTIVE.ToString()); if (identifiertype != null && identifier.LegalInvoiceArtifactId.LegalInvoiceArtifactId.Equals(LegalInvoiceArtifactId)) { if (Identifier_name[i].Equals("TEMPLATE")) { txt_Template_Identifier.Text = identifier.Identifier; } if (Identifier_name[i].Equals("SERIES")) { txt_Series_Identifier.Text = identifier.Identifier; } if (Identifier_name[i].Equals("NUMBER")) { txt_Number_Identifier.Text = identifier.Identifier; } } } #endregion #region load LegalInvoiceArtifactOrgActor string[] orgActorType = { "S", "B" }; for (int i = 0; i < orgActorType.Length; i++) { LegalInvoiceArtifactOrgActor orgActor = BO.get_OrgActorId(session, LegalInvoiceArtifactId, orgActorType[i], Utility.Constant.ROWSTATUS_ACTIVE.ToString()); if (orgActorType[i].Equals("S")) { cbo_Code_sell_Organization.Text = orgActor.Code; txt_AccountNumber_sell_OrgActor.Text = orgActor.AccountNumber; txt_TaxCode_sell_OrgActor.Text = orgActor.TaxCode; txt_PhoneFax_sell_OrgActor.Text = orgActor.TelephoneFax; memo_Address_sell_OrgActor.Text = orgActor.Address; } else { cbo_Code_buy_Organization.Text = orgActor.Code; txt_AccountNumber_buy_OrgActor.Text = orgActor.AccountNumber; txt_Name_buy_OrgActor.Text = orgActor.Name; txt_TaxCode_buy_OrgActor.Text = orgActor.TaxCode; txt_Description_buy_OrgActor.Text = orgActor.Description; memo_Address_buy_OrgActor.Text = orgActor.Address; txt_TelephoneFax_buy_OrgActor.Text = orgActor.TelephoneFax; } } #endregion } catch (Exception) { throw; } }
public void CRUD_LegalInvoiceArtifact_Saving() { try { string rowstatus = Utility.Constant.ROWSTATUS_ACTIVE.ToString(); if (GUIContext.State is LegalInvoiceArtifact_Creating) { rowstatus = Utility.Constant.ROWSTATUS_TEMP.ToString(); } #region Hoa don GTGT NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact artifact = session.GetObjectByKey <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact>(LegalInvoiceArtifactId); NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifactType artifactTypeId = BO.get_LegalInvoiceArtifactTypeId(session, cbo_Code_ArtifactType.Text.ToString(), Utility.Constant.ROWSTATUS_ACTIVE.ToString()); if (artifact == null) { throw new Exception("LegalInvoiceArtifactId is not exist System"); } artifact.LegalInvoiceArtifactTypeId = artifactTypeId; artifact.Code = txt_Code_Artifact.Text; artifact.IssuedDate = DateTime.Parse(txt_IssuedDate_Artifact.Text); artifact.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; artifact.LastUpdateDate = DateTime.Now; session.CommitTransaction(); //save string[] Identifier_name = { "SERIES", "NUMBER", "TEMPLATE" }; for (int i = 0; i < Identifier_name.Length; i++) { LegalInvoiceArtifactIdentifierType identifiertype = BO.get_IdentifierTypeId(session, Identifier_name[i]); LegalInvoiceArtifactIdentifier identifier = BO.get_LegalInvoiceArtifactIdentifier(session, LegalInvoiceArtifactId, identifiertype.LegalInvoiceArtifactIdentifierTypeId, rowstatus); if (identifiertype != null && identifier.LegalInvoiceArtifactId.LegalInvoiceArtifactId.Equals(LegalInvoiceArtifactId)) { if (Identifier_name[i].Equals("TEMPLATE")) { identifier.Identifier = txt_Template_Identifier.Text; } if (Identifier_name[i].Equals("SERIES")) { identifier.Identifier = txt_Series_Identifier.Text; } if (Identifier_name[i].Equals("NUMBER")) { identifier.Identifier = txt_Number_Identifier.Text; } identifier.LegalInvoiceArtifactIdentifierTypeId = identifiertype; //identifierTypeID if (!rowstatus.Equals(Utility.Constant.ROWSTATUS_ACTIVE.ToString())) { identifier.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; //RowStatus } session.CommitTransaction(); //save } } #endregion #region Thong tin ban string[] orgActorType = { "S", "B" }; for (int i = 0; i < orgActorType.Length; i++) { LegalInvoiceArtifactOrgActor orgActor = BO.get_OrgActorId(session, LegalInvoiceArtifactId, orgActorType[i], rowstatus); Organization Organization = BO.get_OrganizationId(session, cbo_Code_buy_Organization.Text.ToString()); if (orgActorType[i].Equals("S")) { Organization = BO.get_OrganizationId(session, cbo_Code_sell_Organization.Text.ToString()); orgActor.Code = Organization.Code; orgActor.AccountNumber = txt_AccountNumber_sell_OrgActor.Text; orgActor.TaxCode = txt_TaxCode_sell_OrgActor.Text; orgActor.Address = memo_Address_sell_OrgActor.Text; orgActor.TelephoneFax = txt_PhoneFax_sell_OrgActor.Text; orgActor.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; } else { orgActor.Code = Organization.Code; orgActor.AccountNumber = txt_AccountNumber_buy_OrgActor.Text; orgActor.TaxCode = txt_TaxCode_buy_OrgActor.Text; orgActor.Address = memo_Address_buy_OrgActor.Text; orgActor.TelephoneFax = txt_TelephoneFax_buy_OrgActor.Text; orgActor.Description = txt_Description_buy_OrgActor.Text; orgActor.Name = txt_Name_buy_OrgActor.Text; } session.CommitTransaction(); //save } #endregion #region thanh toan #endregion #region don vi tham gia #endregion using_state = ""; } catch (Exception) { throw; } }