protected void Grid_ArtifactDetail_RowInserting(object sender, DevExpress.Web.Data.ASPxDataInsertingEventArgs e) { try { session.BeginTransaction(); e.Cancel = true; string rowstatus = Utility.Constant.ROWSTATUS_ACTIVE.ToString(); NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact legalInvoiceArtifactId = BO.get_LegalInvoiceArtifactId(session, LegalInvoiceArtifactId, rowstatus); LegalInvoiceArtifactDetail detail = new LegalInvoiceArtifactDetail(session); Item itemid = BO.get_ItemId(session, itemId, rowstatus); NAS.DAL.Nomenclature.Item.Unit unitid = BO.get_UnitId(session, unitID, rowstatus); //detail.ItemId = itemid; detail.Price = int.Parse(e.NewValues["Price"].ToString()); detail.Amount = int.Parse(e.NewValues["Amount"].ToString()); //detail.UnitId = unitid; detail.Total = int.Parse(e.NewValues["Total"].ToString()); detail.RowStatus = Utility.Constant.ROWSTATUS_ACTIVE; detail.LegalInvoiceArtifactId = legalInvoiceArtifactId; session.FlushChanges(); session.CommitTransaction(); Grid_ArtifactDetail.CancelEdit(); } catch (Exception) { session.RollbackTransaction(); throw; } }
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 NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact get_LegalInvoiceArtifactId(Session session, Guid id, string RowStatus) { try { NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact legalInvoiceArtifactId = session.FindObject <NAS.DAL.Accounting.LegalInvoice.LegalInvoiceArtifact>( CriteriaOperator.And( new BinaryOperator("LegalInvoiceArtifactId", id, BinaryOperatorType.Equal), new BinaryOperator("RowStatus", RowStatus, BinaryOperatorType.Equal) )); if (legalInvoiceArtifactId == null) { return(null); } return(legalInvoiceArtifactId); } 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; } }