protected string Code(string signCode, int count, bool isOrgDiary) { string str; if (count.ToString().Length == 1) { str = "0000" + count; } else { if (count.ToString().Length == 2) { str = "000" + count; } else { if (count.ToString().Length == 3) { str = "00" + count; } else { if (count.ToString().Length == 4) { str = "0" + count; } else { str = count.ToString(); } } } } string text = signCode + str; int num = isOrgDiary ? OrganizationDiary.GetOrgainCostCount(text) : CostDiary.GetCostcount(text); if (num > 0) { text = this.Code(signCode, count + 1, isOrgDiary); } return(text); }
protected string GetIndiaryCode(bool isOrgDiary, string prjId) { string str = "ZZJG"; if (!isOrgDiary && !string.IsNullOrEmpty(prjId)) { string prjCode = this.GetPrjCode(prjId); str = (string.IsNullOrEmpty(prjCode) ? string.Empty : prjCode.Substring(prjCode.Length - 4)); } string str2 = Common2.GetTime(System.DateTime.Now).Replace("-", ""); string text = str + str2; int count; if (isOrgDiary) { count = OrganizationDiary.GetOrgainCostCount(text) + 1; } else { count = CostDiary.GetCostcount(text) + 1; } return(this.Code(text, count, isOrgDiary)); }