protected int colLoadDescriptor(Sec sec) { var match = Regex.Match(sec.body, @"\d+"); int result = match.Success ? Convert.ToInt32(match.Value) : -1; if (result < 1 || result > doc.Body.iEOC()) result = -1; return result; }
/// <summary> /// setFields - write values in Product Fields from cell [i, col(sec)] /// </summary> /// <param name="i">column number</param> /// <param name="sec">Section of the column</param> /// <returns>true, when Field value succesfully set, else - false</returns> protected bool setFields(int i, Sec sec) { int col = colLoadDescriptor(sec); if (col < 0) return false; if (sec.SType == Decl.STypePRICE) { product.price = doc.Dec(i, col); return true; } string sv = doc.Str(i, col); if (sv == null) return false; if (sec.SType == Decl.STypeMAT) product.name = sv; else setField(sv, sec.body); return true; }