Exemplo n.º 1
0
 public static void ValidateUpdateCode(int codeID, string code)
 {
     Broker.DataAccess.DocumentType documentType = new Broker.DataAccess.DocumentType();
     documentType.Code = code;
     documentType.ID   = codeID;
     documentType.TestBeforeUpdate();
 }
Exemplo n.º 2
0
        public static string DocumentSubTypeCodeGenerator(int DocumentTypeID)
        {
            List <DocumentSubType> dstList = DocumentSubType.Select().Where(d => d.DocumentTypeID == DocumentTypeID).OrderBy(d => d.Code).ToList();

            Broker.DataAccess.DocumentType dt = Broker.DataAccess.DocumentType.Get(DocumentTypeID);

            if (dstList.Count == 0)
            {
                return(dt.Code + "001");
            }
            else
            {
                string code    = dstList.Last().Code.Substring(dt.Code.Length);
                int    length  = code.Length;
                string newCode = (int.Parse(code) + 1).ToString();
                while (newCode.Length < length)
                {
                    newCode = "0" + newCode;
                }
                return(dt.Code + newCode);
            }
        }
Exemplo n.º 3
0
 protected void dvDataSourceSubTypes_Inserting(object sender, ObjectDataSourceMethodEventArgs e)
 {
     Broker.DataAccess.DocumentType dt = e.InputParameters["entityToInsert"] as Broker.DataAccess.DocumentType;
     DocumentTypeController.ValidateInsertCode(dt.Code);
 }
Exemplo n.º 4
0
 protected void dvDataSource_Updating(object sender, ObjectDataSourceMethodEventArgs e)
 {
     Broker.DataAccess.DocumentType dt = e.InputParameters["newEntity"] as Broker.DataAccess.DocumentType;
     DocumentTypeController.ValidateUpdateCode(dt.ID, dt.Code);
 }
Exemplo n.º 5
0
 public static void ValidateInsertCode(string code)
 {
     Broker.DataAccess.DocumentType documentType = new Broker.DataAccess.DocumentType();
     documentType.Code = code;
     documentType.TestBeforeInsert();
 }