protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { txtRefNo.Text = OrderAccess.GetRefNumber(); } }
protected void GetRefNo() { DateTime date = System.DateTime.Now; string refNo = date.ToString("yy") + date.ToString("MM"); //System.DateTime.Now.Year.ToString(); string currentRefNo = OrderAccess.GetRefNumber(); string last3 = currentRefNo.Substring(currentRefNo.Length - 3); refNo = refNo + last3; int newRefNo = Int32.Parse(refNo); txtRefNo.Text = (newRefNo + 1).ToString(); lblRefNo.Text = "Last Ref. No : " + currentRefNo; // "Last Ref. No. : " + refNo; }
protected void GetRefNo() { DateTime date = System.DateTime.Now; string refNo = date.ToString("yy") + date.ToString("MM"); //System.DateTime.Now.Year.ToString(); string currentRefNo = OrderAccess.GetRefNumber(); string last3 = currentRefNo.Substring(currentRefNo.Length - 3); // error !!!!! what if value is less than 3 digits ????> if (last3 == "999") { last3 = "000"; } refNo = refNo + last3; int newRefNo = Int32.Parse(refNo); txtRefNo.Text = (newRefNo + 1).ToString(); lblRefNo.Text = "Last Ref. No : " + currentRefNo; // "Last Ref. No. : " + refNo; }
protected void GetRefNo() { txtRefNo.Text = OrderAccess.GetRefNumber(); }