예제 #1
0
    public string Get_CustType(clsDataAccessor objDA, MySqlTransaction objtran)
    {
        string custypeid = "";

        DataSet ds_cust = new DataSet();

        string sqlstr = "SELECT CUSTTYPEID FROM CUSTOMER_TYPE WHERE BLNDEFAULT = 'Y' AND bitFrontendLock='N' and RecordStatus<>'DELETED' and Display='Y'";

        try
        {
            custypeid = objDA.ExecuteScalar(objtran, CommandType.Text, sqlstr, null).ToString();
        }
        catch (System.Exception ex)
        {
            custypeid = "";
        }

        return(custypeid);
    }
예제 #2
0
    public string getTransCount(clsDataAccessor objDA, MySqlTransaction objtran, string StoreNo, string TerminalNo)
    {
        string sql_queuenodigit = "SELECT FUNCTIONVALUE FROM DEFINITIONS_GENERALSETTING WHERE FUNCTIONFIELDNAME = 'NOOFDIGITQUEUENO' AND RETAILERID=@RetailerID";
        int    queuedigit       = 4;

        MySqlParameter[] objparam =
        {
            new MySqlParameter("@RetailerID", StoreNo),
            new MySqlParameter("@TerminalID", TerminalNo)
        };

        try
        {
            queuedigit = int.Parse(objDA.ExecuteScalar(objtran, CommandType.Text, sql_queuenodigit, objparam).ToString());
        }
        catch (Exception e)
        {
            queuedigit = 4;
        }


        string storenostr = int.Parse(StoreNo).ToString("00");
        int    seqlength  = queuedigit - 2;

        string tostringzerostr = "";
        string maxnum          = "1";

        for (int i = 0; i < seqlength; i++)
        {
            tostringzerostr += "0";
        }

        maxnum += tostringzerostr;

        string sqlstr = "SELECT LastQueueNo FROM DEFINITIONS_TERMINAL WHERE RETAILERID=@RetailerID AND TerminalID=@TerminalID AND DISPLAY = 'Y' ";

        int lastno = 0;

        try
        {
            lastno = int.Parse(objDA.ExecuteScalar(objtran, CommandType.Text, sqlstr, objparam).ToString());
        }
        catch (System.Exception ex)
        {
            lastno = 0;
        }

        lastno += 1;

        if (lastno == int.Parse(maxnum))
        {
            string sql_forqueueno = "UPDATE DEFINITIONS_TERMINAL SET LastQueueNo = '0' WHERE DISPLAY = 'Y' AND RETAILERID=@RetailerID AND TERMINALID=@TerminalID";
            objDA.ExecuteNonQuery(objtran, CommandType.Text, sql_forqueueno, objparam);

            lastno = 1;
        }

        string queuestr = storenostr + lastno.ToString(tostringzerostr);

        return(queuestr);
    }