Beispiel #1
0
        public static long Save(Lock m)
        {
            m.Lock_By          = App.session.Username;
            m.Branch_Code      = App.session.Branch_Code;
            m.Machine_Name     = App.session.Machine_Name;
            m.Machine_Username = App.session.Machine_User_Name;
            var sql = SqlFacade.SqlInsert(TableName, "table_name, branch_code, lock_id, ref, lock_by, machine_name, machine_username", "", true);

            m.Id = SqlFacade.Connection.ExecuteScalar <long>(sql, m);
            return(m.Id);
        }
Beispiel #2
0
        public static long Save(Session m)
        {
            long seq = 0;   // New inserted sequence

            if (m.Id == 0)
            {
                var sql = SqlFacade.SqlInsert(TableName, "username, branch_code, version, machine_name, machine_user_name", "", true);
                seq = SqlFacade.Connection.ExecuteScalar <long>(sql, m);
            }
            return(seq);
        }
Beispiel #3
0
        public static long Save(UnitMeasure m)
        {
            string sql = "";

            if (m.Id == 0)
            {
                m.Insert_By = App.session.Username;
                sql         = SqlFacade.SqlInsert(TableName, "code, default_factor, description, insert_by", "", true);
                m.Id        = SqlFacade.Connection.ExecuteScalar <long>(sql, m);
            }
            else
            {
                m.Change_By = App.session.Username;
                sql         = SqlFacade.SqlUpdate(TableName, "code, description, default_factor, note, change_by, change_at, change_no", "change_at = now(), change_no = change_no + 1", "id = :id");
                SqlFacade.Connection.Execute(sql, m);
                ReleaseLock(m.Id);  // Unlock
            }
            return(m.Id);
        }
Beispiel #4
0
        public static long Save(Account m)
        {
            string sql = "";

            m.Branch_Code = App.session.Branch_Code;
            if (m.Id == 0)
            {
                m.Insert_By = App.session.Username;
                sql         = SqlFacade.SqlInsert(TableName, "branch_code, code, description, type, address, name, phone, fax, email, note, insert_by", "", true);
                m.Id        = SqlFacade.Connection.ExecuteScalar <long>(sql, m);
            }
            else
            {
                m.Change_By = App.session.Username;
                sql         = SqlFacade.SqlUpdate(TableName, "branch_code, code, description, type, address, name, phone, fax, email, note, change_by, change_at, change_no", "change_at = now(), change_no = change_no + 1", "id = :id");
                SqlFacade.Connection.Execute(sql, m);
                ReleaseLock(m.Id);  // Unlock
            }
            return(m.Id);
        }
Beispiel #5
0
        private void Add()
        {
            var sql = SqlFacade.SqlInsert(TableName, "username, code, value, note", "", true);

            Id = SqlFacade.Connection.ExecuteScalar <long>(sql, new { Username, Code, Value, Note });
        }