Exemplo n.º 1
0
    public string Get_Auto_Custcode(clsDataAccessor objDA, MySqlTransaction objtran)
    {
        string  cust_auto_num = "";
        string  custautono    = "";
        DataSet ds_cust       = new DataSet();

        string sql = "SELECT VCHPREFIXCUST, CUSTSTARTNO,CUSTNEXTNO, BITCUSTCODEEQUALICNO FROM CUSTOMER_DEFINITIONS WHERE DISPLAY = 'Y'";

        ds_cust = objDA.ExecuteDataSet(objtran, CommandType.Text, sql, null);

        if (ds_cust.Tables[0].Rows.Count > 0)
        {
            int runNo = int.Parse(ds_cust.Tables[0].Rows[0]["CUSTSTARTNO"].ToString()) + int.Parse(ds_cust.Tables[0].Rows[0]["CUSTNEXTNO"].ToString()) + 1;
            custautono = ds_cust.Tables[0].Rows[0]["VCHPREFIXCUST"].ToString() + (runNo).ToString();
        }

        ds_cust.Clear();
        ds_cust.Dispose();

        return(cust_auto_num);
    }